Application using SDL exiting on any keypress. It shouldn't be though

时间:2015-05-12 22:52:04

标签: c++ loops keyboard switch-statement sdl

I cannot figure out how to properly handle key presses with the SDL library.

As of right now, I have the following code:

ALTER TABLE tbl MODIFY COLUMN txt TEXT CHARACTER SET utf8

There is a Drawable class of which buttons is an instance of. The states are different frames I would like to draw. However, I only want to draw them on the press of the left or right arrow keys. As of now, the program is simply exiting on any key press.

I have no idea where to go from here.

2 个答案:

答案 0 :(得分:3)

makecert -r -pe -n "CN=PC-Name" -b 01/01/2000 -e 01/01/2036 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 is missing his break statement, which lead every key press to execute the code int the case SDL_KEYDOWN: case as well. It should be

SDL_QUIT

答案 1 :(得分:0)

你忘了休息;在你写的每个案例陈述中。 你也可以加上这个:

case SDLK_ESCAPE:< ----所以你也可以按键盘上的ESC退出:)

另一件事,SDL_Quit()将处理窗口破坏。 如果您使用SDL_Init()启动SDL,则无需担心关闭子系统。如果您明确调用了SDL_VideoInit(),则必须使用SDL_QuitSubSystem关闭子系统。

你也可以删除默认值:Running = true; (在修好休息之后;)

祝你好运:)