Questions tagged «standards»

2
大型游戏中的输入管理技术
是否有用于管理大型游戏中输入的标准技术。当前,在我的项目中,所有输入处理都在游戏循环中完成,如下所示: while(SDL_PollEvent(&event)){ switch(event.type){ case SDL_QUIT: exit = 1; break; case SDL_KEYDOWN: switch(event.key.keysym.sym){ case SDLK_c: //do stuff break; } break; case SDL_MOUSEBUTTONDOWN: switch(event.button.button){ case SDL_BUTTON_MIDDLE: //do stuff break; } } break; } (我正在使用SDL,但我希望主要实践也适用于库和框架)。对于大型项目,这似乎不是最佳解决方案。我可能有几个对象都想知道用户所按的内容,因此使这些对象处理输入更为有意义。但是,它们不能全部处理输入,因为一个事件发生后,它将被推入事件缓冲区,因此另一个对象将不会接收该输入。最常用的方法是什么?
16 c++  sdl  input  standards 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.