16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 07:49:19 +02:00

Make launcher respond to window resize

This commit is contained in:
jakubg1
2025-09-09 17:08:23 +02:00
parent c217081823
commit 9fa22d81e5
12 changed files with 105 additions and 133 deletions

View File

@@ -74,6 +74,7 @@ void framebuffer_resize_callback( GLFWwindow *, int w, int h ) {
void window_resize_callback( GLFWwindow *, int w, int h ) {
Global.window_size = glm::ivec2(w, h);
Application.on_window_resize(w, h);
}
void cursor_pos_callback( GLFWwindow *window, double x, double y ) {
@@ -603,19 +604,19 @@ eu07_application::pop_mode() {
}
bool
eu07_application::push_mode( eu07_application::mode const Mode ) {
eu07_application::push_mode( mode const Mode ) {
if( Mode >= mode::count_ )
if( Mode >= count_ )
return false;
if (!m_modes[Mode]) {
if (Mode == mode::launcher)
if (Mode == launcher)
m_modes[Mode] = std::make_shared<launcher_mode>();
if (Mode == mode::scenarioloader)
if (Mode == scenarioloader)
m_modes[Mode] = std::make_shared<scenarioloader_mode>();
if (Mode == mode::driver)
if (Mode == driver)
m_modes[Mode] = std::make_shared<driver_mode>();
if (Mode == mode::editor)
if (Mode == editor)
m_modes[Mode] = std::make_shared<editor_mode>();
if (!m_modes[Mode]->init())
@@ -733,6 +734,14 @@ void eu07_application::on_focus_change(bool focus) {
}
}
void eu07_application::on_window_resize(int w, int h)
{
if (m_modestack.empty())
return;
m_modes[m_modestack.top()]->on_window_resize(w, h);
}
GLFWwindow *
eu07_application::window(int const Windowindex, bool visible, int width, int height, GLFWmonitor *monitor, bool keep_ownership , bool share_ctx) {