mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-10-11 00:38:10 +03:00
Pump events in sys_sleep()
This allows handling window events while fading etc.
This commit is contained in:
@@ -409,6 +409,7 @@ void NACT::wait_after_open_menu()
|
||||
}
|
||||
|
||||
void NACT::sys_sleep(int ms) {
|
||||
pump_events();
|
||||
ags->update_screen();
|
||||
SDL_Delay(ms);
|
||||
}
|
||||
|
||||
+1
-1
@@ -266,7 +266,7 @@ public:
|
||||
void fatal(const char* msg, ...);
|
||||
|
||||
private:
|
||||
bool pump_events();
|
||||
void pump_events();
|
||||
void on_syswmevent(SDL_SysWMmsg* msg);
|
||||
};
|
||||
|
||||
|
||||
@@ -15,13 +15,14 @@
|
||||
|
||||
static int mousex, mousey, fingers;
|
||||
|
||||
bool NACT::pump_events()
|
||||
void NACT::pump_events()
|
||||
{
|
||||
SDL_Event e;
|
||||
while (SDL_PollEvent(&e)) {
|
||||
switch (e.type) {
|
||||
case SDL_QUIT:
|
||||
return true;
|
||||
terminate = true;
|
||||
break;
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
mousex = e.motion.x;
|
||||
@@ -45,7 +46,6 @@ bool NACT::pump_events()
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8 NACT::get_key()
|
||||
@@ -54,8 +54,7 @@ uint8 NACT::get_key()
|
||||
|
||||
texthook_keywait();
|
||||
|
||||
if (pump_events())
|
||||
terminate = true;
|
||||
pump_events();
|
||||
|
||||
// キーボード&マウス
|
||||
const Uint8* key = SDL_GetKeyboardState(NULL);
|
||||
@@ -99,8 +98,7 @@ uint8 NACT::get_key()
|
||||
|
||||
void NACT::get_cursor(int* x, int* y)
|
||||
{
|
||||
if (pump_events())
|
||||
terminate = true;
|
||||
pump_events();
|
||||
*x = mousex;
|
||||
*y = mousey;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user