X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Flibgame%2Fsystem.c;h=dc7dba8b2db2c763e19ee8cc274c38d73cc50b06;hp=7fcb784d66c9f7608f00dad238a52b76cc0ce464;hb=e617cc94b68c43105fc3c06d26d31c9bc99161a4;hpb=8e4eb47925648cd84d134dfe05ca7fb30727dc24 diff --git a/src/libgame/system.c b/src/libgame/system.c index 7fcb784d..dc7dba8b 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -570,6 +570,7 @@ void InitVideoBuffer(int width, int height, int depth, boolean fullscreen) video.window_scaling_available = WINDOW_SCALING_STATUS; + video.frame_counter = 0; video.frame_delay = 0; video.frame_delay_value = GAME_FRAME_DELAY; @@ -1576,6 +1577,28 @@ void SetMouseCursor(int mode) gfx.cursor_mode_final = mode_final; } +void UpdateRawMousePosition(int mouse_x, int mouse_y) +{ + // mouse events do not contain logical screen size corrections yet + SDLCorrectRawMousePosition(&mouse_x, &mouse_y); + + mouse_x -= video.screen_xoffset; + mouse_y -= video.screen_yoffset; + + gfx.mouse_x = mouse_x; + gfx.mouse_y = mouse_y; +} + +void UpdateMousePosition(void) +{ + int mouse_x, mouse_y; + + SDL_PumpEvents(); + SDL_GetMouseState(&mouse_x, &mouse_y); + + UpdateRawMousePosition(mouse_x, mouse_y); +} + // ============================================================================ // audio functions @@ -1643,6 +1666,11 @@ void PeekEvent(Event *event) SDL_PeepEvents(event, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT); } +void PumpEvents(void) +{ + SDL_PumpEvents(); +} + void CheckQuitEvent(void) { if (SDL_QuitRequested())