Added blocking event function, updated documentation

This commit is contained in:
Robert 2020-05-16 19:55:44 +02:00
parent c90fd88efe
commit 05c7cddfd3
2 changed files with 23 additions and 4 deletions

View file

@ -63,4 +63,9 @@ namespace sdlu
event = NULL;
return false;
}
bool RenderWindow::WaitEvent(SDL_Event& event)
{
while (!PollEvent(event)) continue;
}
}

View file

@ -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