我有代码。
无论是使用哪个鼠标按钮的语句,都没有任何反应。
int userinput()
{
while(hasquit == false)
{
while ( SDL_PollEvent(&event) )
{
if ( event.type == SDL_QUIT )
{
hasquit = true;
}
if ( event.type == SDL_KEYDOWN )
{
if ( event.key.keysym.sym == SDLK_ESCAPE )
{
hasquit = true;
}
if(event.type == SDL_MOUSEBUTTONDOWN)
{
if(event.button.button == SDL_BUTTON_LEFT)
{
//do something
}
}
}
}
}
}
这基本上是我从这些教程中复制的一个事件结构。我可以得到SDL_QUIT和SDLK_ESCAPE事件,但如果我尝试让
hasquit = true
无论是使用哪个鼠标按钮的语句,都没有任何反应。