From c6c21ea0ffe552dd8e390398f0a7752ff57adebf Mon Sep 17 00:00:00 2001 From: Pieter Hulshoff Date: Fri, 30 Dec 2016 00:32:28 +0100 Subject: [PATCH] During launchExit (returning from a game), empty the input event queue, and reset the scrolling text. --- .../Source/Graphics/Component/ReloadableScrollingText.cpp | 6 ++++++ RetroFE/Source/Graphics/Component/ReloadableScrollingText.h | 1 + RetroFE/Source/RetroFE.cpp | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/RetroFE/Source/Graphics/Component/ReloadableScrollingText.cpp b/RetroFE/Source/Graphics/Component/ReloadableScrollingText.cpp index 1e6304d..3077752 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableScrollingText.cpp +++ b/RetroFE/Source/Graphics/Component/ReloadableScrollingText.cpp @@ -94,6 +94,12 @@ void ReloadableScrollingText::update(float dt) } +void ReloadableScrollingText::launchExit( ) +{ + reloadTexture( ); +} + + void ReloadableScrollingText::freeGraphicsMemory( ) { Component::freeGraphicsMemory( ); diff --git a/RetroFE/Source/Graphics/Component/ReloadableScrollingText.h b/RetroFE/Source/Graphics/Component/ReloadableScrollingText.h index 7524b7a..c613864 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableScrollingText.h +++ b/RetroFE/Source/Graphics/Component/ReloadableScrollingText.h @@ -29,6 +29,7 @@ public: void update(float dt); void draw( ); void freeGraphicsMemory( ); + void launchExit(); private: void reloadTexture( ); diff --git a/RetroFE/Source/RetroFE.cpp b/RetroFE/Source/RetroFE.cpp index 5747a13..2e8bf31 100644 --- a/RetroFE/Source/RetroFE.cpp +++ b/RetroFE/Source/RetroFE.cpp @@ -135,6 +135,11 @@ void RetroFE::launchExit() SDL_RestoreWindow(SDL::getWindow()); SDL_RaiseWindow(SDL::getWindow()); SDL_SetWindowGrab(SDL::getWindow(), SDL_TRUE); + + // Empty event queue + SDL_Event e; + while (SDL_PollEvent(&e)); + input_.resetStates(); attract_.reset();