qmlfrontend/Page1.qml
changeset 15919 d52f5d8e75e6
parent 15238 b32c52c76977
child 16041 caba603f461f
--- a/qmlfrontend/Page1.qml	Sat Nov 12 15:40:20 2022 +0100
+++ b/qmlfrontend/Page1.qml	Sat Nov 12 21:12:14 2022 +0100
@@ -2,66 +2,67 @@
 import Hedgewars.Engine 1.0
 
 Page1Form {
-  focus: true
+    focus: true
 
-  property HWEngine hwEngine
-  property NetSession netSession
+    property HWEngine hwEngine
+    property NetSession netSession
+
+    Component {
+        id: hwEngineComponent
 
-  Component {
-    id: hwEngineComponent
-
-    HWEngine {
-      engineLibrary: "./libhedgewars_engine.so"
-      previewAcceptor: PreviewAcceptor
-      onPreviewImageChanged: previewImage.source = "image://preview/image"
-      onPreviewIsRendering: previewImage.source = "qrc:/res/iconTime.png"
+        HWEngine {
+            engineLibrary: "../rust/lib-hedgewars-engine/target/debug/libhedgewars_engine.so"
+            dataPath: "../share/hedgewars/Data"
+            previewAcceptor: PreviewAcceptor
+            onPreviewImageChanged: previewImage.source = "image://preview/image"
+            onPreviewIsRendering: previewImage.source = "qrc:/res/iconTime.png"
+        }
     }
-  }
 
-  Component {
-    id: netSessionComponent
+    Component {
+        id: netSessionComponent
 
-    NetSession {
-      nickname: "test0272"
-      url: "hwnet://gameserver.hedgewars.org:46632"
+        NetSession {
+            nickname: "test0272"
+            url: "hwnet://gameserver.hedgewars.org:46632"
+        }
     }
-  }
 
-  Component.onCompleted: {
-    hwEngine = hwEngineComponent.createObject()
-  }
+    Component.onCompleted: {
+        hwEngine = hwEngineComponent.createObject()
+    }
 
-  tickButton {
-    onClicked: {
-      tickButton.visible = false
-      gameView.tick(100)
+    tickButton {
+        onClicked: {
+            tickButton.visible = false
+            gameView.tick(100)
+        }
     }
-  }
-  gameButton {
-    visible: !gameView.engineInstance
-    onClicked: {
-      var engineInstance = hwEngine.runQuickGame()
-      gameView.engineInstance = engineInstance
+    gameButton {
+        visible: !gameView.engineInstance
+        onClicked: {
+            const engineInstance = hwEngine.runQuickGame()
+            gameView.engineInstance = engineInstance
+        }
     }
-  }
-  button1 {
-    visible: !gameView.engineInstance
-    onClicked: {
-      hwEngine.getPreview()
+    button1 {
+        visible: !gameView.engineInstance
+        onClicked: {
+            hwEngine.getPreview()
+        }
+    }
+    netButton.onClicked: {
+        netSession = netSessionComponent.createObject()
+        netSession.open()
     }
-  }
-  netButton.onClicked: {
-    netSession = netSessionComponent.createObject()
-    netSession.open()
-  }
+
+    Keys.onPressed: {
+        if (event.key === Qt.Key_Enter)
+            gameView.engineInstance.longEvent(Engine.Attack, Engine.Set)
+    }
 
-  Keys.onPressed: {
-    if (event.key === Qt.Key_Enter)
-      gameView.engineInstance.longEvent(Engine.Attack, Engine.Set)
-  }
-
-  Keys.onReleased: {
-    if (event.key === Qt.Key_Enter)
-      gameView.engineInstance.longEvent(Engine.Attack, Engine.Unset)
-  }
+    Keys.onReleased: {
+        if (event.key === Qt.Key_Enter)
+            gameView.engineInstance.longEvent(Engine.Attack, Engine.Unset)
+    }
 }