Save/restore window size in UX settings.

PiperOrigin-RevId: 913695007
Change-Id: I3366b11a5de53292d4ffe0e4c46f866381624788
This commit is contained in:
Haroon Qureshi
2026-05-11 07:43:29 -07:00
committed by Copybara-Service
parent 465e574c42
commit 5d818306ef
4 changed files with 33 additions and 1 deletions
+12
View File
@@ -177,6 +177,18 @@ void Window::SetTitle(std::string_view title) {
SDL_SetWindowTitle(sdl_window_, title.data());
}
void Window::Resize(int width, int height) {
SDL_SetWindowSize(sdl_window_, width, height);
SDL_SetWindowPosition(sdl_window_, SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED);
SDL_GetWindowSize(sdl_window_, &width_, &height_);
int drawable_width = width_;
int drawable_height = height_;
SDL_GL_GetDrawableSize(sdl_window_, &drawable_width, &drawable_height);
scale_ = (float)drawable_width / (float)width_;
}
void Window::DisableWindowResizing() {
SDL_SetWindowResizable(sdl_window_, SDL_FALSE);
}