[win32] honor timeout value in mp_pump_events
This commit is contained in:
parent
0d65d19436
commit
21aa1bef68
|
@ -268,7 +268,13 @@ MP_API void mp_set_cursor(mp_mouse_cursor cursor);
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// Main loop and events handling
|
// Main loop and events handling
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
/*NOTE:
|
||||||
|
mp_pump_events() pumps system events into the event queue. A timeout of 0 polls for events,
|
||||||
|
while a timeout of -1 blocks for events. A timeout > 0 blocks until new events are available
|
||||||
|
or the timeout elapses.
|
||||||
|
|
||||||
|
mp_next_event() get the next event from the event queue, allocating from the passed arena
|
||||||
|
*/
|
||||||
MP_API void mp_pump_events(f64 timeout);
|
MP_API void mp_pump_events(f64 timeout);
|
||||||
MP_API mp_event* mp_next_event(mem_arena* arena);
|
MP_API mp_event* mp_next_event(mem_arena* arena);
|
||||||
|
|
||||||
|
|
|
@ -553,6 +553,16 @@ void mp_request_quit()
|
||||||
void mp_pump_events(f64 timeout)
|
void mp_pump_events(f64 timeout)
|
||||||
{
|
{
|
||||||
MSG message;
|
MSG message;
|
||||||
|
|
||||||
|
if(timeout < 0)
|
||||||
|
{
|
||||||
|
WaitMessage();
|
||||||
|
}
|
||||||
|
else if(timeout > 0)
|
||||||
|
{
|
||||||
|
MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD) (timeout * 1e3), QS_ALLEVENTS);
|
||||||
|
}
|
||||||
|
|
||||||
while(PeekMessage(&message, 0, 0, 0, PM_REMOVE))
|
while(PeekMessage(&message, 0, 0, 0, PM_REMOVE))
|
||||||
{
|
{
|
||||||
TranslateMessage(&message);
|
TranslateMessage(&message);
|
||||||
|
|
Loading…
Reference in New Issue