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库之间是否存在某种灰色区域?或者是教程犯了一个错误?
非常感谢