然而,我在SDL_PeepEvents( sdlevent, EVENT_BUFFER_SIZE, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_SYSWMEVENT );
运行几秒钟后调用并使用窗口(调整大小/移动/最小化)它不会在单击 x 以关闭窗口时接收事件。
void Window::pollWindowEvents( )
{
const int EVENT_BUFFER_SIZE = 16;
SDL_Event sdlevent[ EVENT_BUFFER_SIZE ]; //The SDL event that we will poll to get events.
SDL_PumpEvents( );
int numEvents = SDL_PeepEvents( sdlevent, EVENT_BUFFER_SIZE, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_SYSWMEVENT );
std::cout << numEvents << std::endl;
for ( int i = 0; i < numEvents; ++i )
{
switch ( sdlevent[ i ].type )
{
case SDL_QUIT:
closed = true;
std::cout << sdlevent[ i ].type << std::endl;
break;
default:
std::cout << sdlevent[ i ].type << std::endl;
break;
};
}
}
有谁知道我做错了什么?