X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsystem.c;h=d6ede9ffd169ed8808177c144864940f957fe260;hb=6af16a4497e5c9e15eb24700ba8e8db0a13e0202;hp=6f27daf6e94a24461ce60311ce0b1630139fdcba;hpb=3cc2ee99e57014c6962d26365e92bd3eac36a492;p=rocksndiamonds.git diff --git a/src/libgame/system.c b/src/libgame/system.c index 6f27daf6..d6ede9ff 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -1576,6 +1576,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 @@ -1623,6 +1645,11 @@ void SetAudioMode(boolean enabled) // event functions // ============================================================================ +void InitEventFilter(EventFilter filter_function) +{ + SDL_SetEventFilter(filter_function, NULL); +} + boolean PendingEvent(void) { return (SDL_PollEvent(NULL) ? TRUE : FALSE); @@ -1638,6 +1665,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())