added width() and height() getters

This commit is contained in:
Bob Polis 2020-10-25 20:31:19 +01:00
parent 05cf3ba0e2
commit 6097614905
2 changed files with 14 additions and 0 deletions

View File

@ -143,3 +143,15 @@ bool Window::handle_event(const SDL_Event& event, bool quit) {
}
return quit;
}
int Window::width() const {
int w, h;
SDL_GetWindowSize(_w.get(), &w, &h);
return w;
}
int Window::height() const {
int w, h;
SDL_GetWindowSize(_w.get(), &w, &h);
return h;
}

View File

@ -40,6 +40,8 @@ namespace sc {
SDL_Texture* texture() const { return _t.get(); }
void set_size(int w, int h);
int width() const;
int height() const;
void update() const;
void show_image(const Image& image);