当我运行我的应用程序时,我遇到了大量的输入延迟。
更多细节:当我按下“w”、“a”、“s”、“d”(我指定的输入键)时,对象会移动,但是在释放键后它会继续移动很长时间。源代码在下面,但是代码的一小部分已经被剪掉以缩短问题,但是如果下面的源代码不能编译,我将所有代码放在 github 上。 https://github.com/TreeStain/DodgeLinuxGame.git谢谢你的时间。-特里斯坦
道奇.c:
#define ASPECT_RATIO_X 2
#define ASPECT_RATIO_Y 1
#define FRAMES_PER_SECOND 60
#include <ncurses.h>
#include "object.h"
#include "render.h"
int main()
{
initscr();
cbreak();
noecho();
nodelay(stdscr, 1);
object objs[1];
object colObj; colObj.x = 10; colObj.y = 6;
colObj.w = 2; colObj.h = 2;
colObj.sprite = '*';
colObj.ySpeed = 1;
colObj.xSpeed = 1;
objs[0] = colObj;
//halfdelay(1);
while (1)
{
char in = getch();
if (in == 'w')
objs[0].y -= objs[0].ySpeed * ASPECT_RATIO_Y;
if (in == 's')
objs[0].y …Run Code Online (Sandbox Code Playgroud)