Skip to content

Commit

Permalink
[GameState] Fixed crash when setting fullscreen mode on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
Unarelith committed Oct 29, 2023
1 parent 690348f commit 4575265
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions source/client/states/GameState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,15 @@ void GameState::onEvent(const SDL_Event &event) {
}

if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
Config::screenWidth = (u16)event.window.data1;
Config::screenHeight = (u16)event.window.data2;
if (event.window.data1 != 0 && event.window.data2 != 0) {
Config::screenWidth = (u16)event.window.data1;
Config::screenHeight = (u16)event.window.data2;

m_camera.setAspectRatio((float)Config::screenWidth / Config::screenHeight);
m_hud.setup();
m_camera.setAspectRatio((float)Config::screenWidth / Config::screenHeight);
m_hud.setup();

m_fbo.init(Config::screenWidth, Config::screenHeight);
m_fbo.init(Config::screenWidth, Config::screenHeight);
}
}
}

Expand Down

0 comments on commit 4575265

Please sign in to comment.