diff --git a/SDLU/graphics/RenderWindow.cpp b/SDLU/graphics/RenderWindow.cpp index 1e40e7b..929b16a 100644 --- a/SDLU/graphics/RenderWindow.cpp +++ b/SDLU/graphics/RenderWindow.cpp @@ -63,4 +63,9 @@ namespace sdlu event = NULL; return false; } + + bool RenderWindow::WaitEvent(SDL_Event& event) + { + while (!PollEvent(event)) continue; + } } \ No newline at end of file diff --git a/SDLU/graphics/RenderWindow.hpp b/SDLU/graphics/RenderWindow.hpp index fcdbe25..5673241 100644 --- a/SDLU/graphics/RenderWindow.hpp +++ b/SDLU/graphics/RenderWindow.hpp @@ -28,8 +28,8 @@ namespace sdlu /** * @brief Creates a window and renderer with the given parameters * - * @param dimension A vector containing the width and height - * @param title The title of the create window + * @param[in] dimension A vector containing the width and height + * @param[in] title The title of the create window */ RenderWindow(Vector2u dimension, const std::string& title, Uint32 windowFlags, Uint32 rendererFlags); @@ -46,8 +46,8 @@ namespace sdlu * they were already created the function does nothing and returns. * If it fails to create either, an ObjectCreationException is thrown. * - * @param dimension A vector containing the width and height - * @param title The title of the create window + * @param[in] dimension A vector containing the width and height + * @param[in] title The title of the create window */ void Create(Vector2u dimension, const std::string& title, Uint32 windowFlags, Uint32 rendererFlags); @@ -64,8 +64,22 @@ namespace sdlu */ bool IsOpen(); + /** + * @brief A non-blocking event polling function + * + * @param[out] event An object to write the latest event to + * @return True if there was an event, False if there wasn't + */ bool PollEvent(SDL_Event& event); + /** + * @brief A blocking event polling function + * + * @param[out] event An object to write the latest event to + * @return True if there was an event, False if there wasn't + */ + bool WaitEvent(SDL_Event& event); + protected: SDL_Window* m_pWindow; ///< A pointer to the window object SDL_Renderer* m_pRenderer; ///< A pointer to the renderer object