0
我正在努力通過一些ncurses教程,因爲我想提高一些C編程技能。我正在教程模擬一個簡單的網球比賽的點。C編程中的2D遊戲編程
什麼讓我困惑的是:
* think of posX as relating to rows, the bottom of the screen will be at
maximum Y value, so subtract 2, to set the racket near the bottom */
p.posX = SCREEN_HEIGHT - 2;
/* think of posY as relating to a column, the middle of the screen will be
at the middle of the screen_width, divided by 2, to set racket at center */
p.posY = SCREEN_WIDTH/2;
說,球拍是向左移動用戶:
void moveRacketLeft() {
if (p.posY - 2 > 0) { // ensure racket is still on screen
mvprintw(p.posX, p.posY-1, " "); // if true, it will print an empty space, deleting the racket
p.posY --; // remember to decrement, as we are going to the left
}
}
什麼混淆了我這個,就是X和Y的位置似乎已經逆轉,我不知道如何在邏輯上「得到它」。
在C編程的常規座標和使用ncurses庫之間是否存在某種灰色區域?或者是教程犯了一個錯誤?
非常感謝