qmlfrontend/game_view.cpp
changeset 15894 ebc50f21e849
parent 14842 ef9630519491
child 15895 9b8d4f34e0f3
--- a/qmlfrontend/game_view.cpp	Tue Nov 15 14:27:22 2022 +0100
+++ b/qmlfrontend/game_view.cpp	Tue Nov 15 15:25:37 2022 +0100
@@ -42,7 +42,9 @@
 void GameView::cleanup() { m_renderer.reset(); }
 
 void GameView::setEngineInstance(EngineInstance* engineInstance) {
-  if (m_engineInstance == engineInstance) return;
+  if (m_engineInstance == engineInstance) {
+    return;
+  }
 
   cleanup();
   m_engineInstance = engineInstance;
@@ -59,13 +61,13 @@
             &GameViewRenderer::paint, Qt::DirectConnection);
   }
 
-  if (m_windowChanged || (m_viewportSize != window()->size())) {
+  if (m_windowChanged || (m_viewportSize != size())) {
     m_windowChanged = false;
 
     if (m_engineInstance)
       m_engineInstance->setOpenGLContext(window()->openglContext());
 
-    m_viewportSize = window()->size();
+    m_viewportSize = size().toSize();
     m_centerPoint = QPoint(m_viewportSize.width(), m_viewportSize.height()) / 2;
   }
 
@@ -75,7 +77,9 @@
     QCursor::setPos(mapToGlobal(m_centerPoint).toPoint());
   }
 
-  if (m_renderer) m_renderer->tick(m_delta);
+  if (m_renderer) {
+    m_renderer->tick(m_delta);
+  }
 }
 
 GameViewRenderer::GameViewRenderer()
@@ -90,7 +94,9 @@
 }
 
 void GameViewRenderer::paint() {
-  if (m_delta == 0) return;
+  if (m_delta == 0) {
+    return;
+  }
 
   if (m_engineInstance) {
     m_engineInstance->advance(m_delta);