# HG changeset patch # User unC0Rr # Date 1716126926 -7200 # Node ID 0e90bdfc26420e02eb1a4297ecd8d99bf945efac # Parent e66feb918d71a6e4507f618998d423db3fb00571 Handle game view resize diff -r e66feb918d71 -r 0e90bdfc2642 qmlfrontend/game_view.cpp --- a/qmlfrontend/game_view.cpp Thu May 16 14:11:16 2024 +0200 +++ b/qmlfrontend/game_view.cpp Sun May 19 15:55:26 2024 +0200 @@ -23,7 +23,8 @@ QPointer m_gameView; QPointer m_window; - bool m_inited{false}; + bool m_dirty{true}; + QSizeF m_gameViewSize; }; void GameViewRenderer::render() { @@ -33,8 +34,8 @@ return; } - if (!m_inited) { - m_inited = true; + if (m_dirty) { + m_dirty = false; engine->setOpenGLContext(QOpenGLContext::currentContext()); } @@ -57,6 +58,12 @@ m_gameView = qobject_cast(fbo); m_window = fbo->window(); } + + if (const auto currentSize = m_gameView->size(); + currentSize != m_gameViewSize) { + m_gameViewSize = currentSize; + m_dirty = true; + } } GameView::GameView(QQuickItem* parent)