Add window size getters

This commit is contained in:
Dmitry Marakasov 2014-02-03 04:37:31 +04:00
parent 648a43369b
commit c89ec85164
2 changed files with 24 additions and 0 deletions

View File

@ -46,6 +46,24 @@ Window& Window::operator=(Window&& other) noexcept {
return *this;
}
Point Window::GetSize() const {
int w, h;
SDL_GetWindowSize(window_, &w, &h);
return Point(w, h);
}
int Window::GetWidth() const {
int w, h;
SDL_GetWindowSize(window_, &w, &h);
return w;
}
int Window::GetHeight() const {
int w, h;
SDL_GetWindowSize(window_, &w, &h);
return h;
}
SDL_Window* Window::Get() const {
return window_;
}

View File

@ -24,6 +24,8 @@
#include <SDL2/SDL_stdinc.h>
#include <SDL2pp/Point.hh>
struct SDL_Window;
namespace SDL2pp {
@ -41,6 +43,10 @@ public:
Window& operator=(const Window& other) = delete;
Window& operator=(Window&& other) noexcept;
Point GetSize() const;
int GetWidth() const;
int GetHeight() const;
SDL_Window* Get() const;
};