Skip to content

Commit

Permalink
SDL/Window: added getter for output size (pixels)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Jun 19, 2017
1 parent eba8770 commit 3ea1ae8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/sdl/window.cpp
Expand Up @@ -76,6 +76,14 @@ void window::set_size(const int w, const int h)
SDL_SetWindowSize(window_, w, h);
}

SDL_Point window::get_output_size()
{
SDL_Point res;
SDL_GetRendererOutputSize(*this, &res.x, &res.y);

return res;
}

void window::center()
{
SDL_SetWindowPosition(window_, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
Expand Down
5 changes: 5 additions & 0 deletions src/sdl/window.hpp
Expand Up @@ -83,6 +83,11 @@ class window
*/
void set_size(const int w, const int h);

/**
* Gets the Window's output size, in pixels.
*/
SDL_Point get_output_size();

/**
* Dummy function for centering the window.
*/
Expand Down

0 comments on commit 3ea1ae8

Please sign in to comment.