Setting image no longer resizes window

It caused bugs in more general cases.
You should resize the window from app code when necessary.
This commit is contained in:
Bob Polis 2021-02-01 10:50:40 +01:00
parent f1e82f6126
commit 3db2099635

View File

@ -118,7 +118,7 @@ void Window::update() {
void Window::show_image(const Image& image) { void Window::show_image(const Image& image) {
// create texture from surface // create texture from surface
_t.reset(SDL_CreateTextureFromSurface(_r.get(), image.surface())); _t.reset(SDL_CreateTextureFromSurface(_r.get(), image.surface()));
/*
// get screen size, to scale down if image is too big // get screen size, to scale down if image is too big
int w {image.width()}; int w {image.width()};
int h {image.height()}; int h {image.height()};
@ -136,8 +136,13 @@ void Window::show_image(const Image& image) {
h = static_cast<int>(round(w / image_ratio)); h = static_cast<int>(round(w / image_ratio));
} }
} }
int ww, wh;
SDL_GetWindowSize(_w.get(), &ww, &wh);
if (ww != w || wh != h) {
set_size(w, h); set_size(w, h);
} }
*/
}
void Window::add_event_handler(WindowEventHandler handler, SDL_WindowEventID type) { void Window::add_event_handler(WindowEventHandler handler, SDL_WindowEventID type) {
auto it = _event_handlers.find(type); auto it = _event_handlers.find(type);