qmlfrontend/Page1.qml
changeset 14854 aed75d439027
parent 14372 b6824a53d4b1
child 14915 a3ad06ac390e
--- a/qmlfrontend/Page1.qml	Mon Apr 29 23:13:52 2019 +0200
+++ b/qmlfrontend/Page1.qml	Mon Apr 29 23:41:25 2019 +0200
@@ -2,7 +2,9 @@
 import Hedgewars.Engine 1.0
 
 Page1Form {
-  property var hwEngine
+  focus: true
+
+  property HWEngine hwEngine
 
   Component {
     id: hwEngineComponent
@@ -19,14 +21,35 @@
     hwEngine = hwEngineComponent.createObject()
   }
 
-  tickButton.onClicked: {
-    gameView.tick(100)
+  tickButton {
+    onClicked: {
+      tickButton.visible = false
+      gameView.tick(100)
+    }
+  }
+  gameButton {
+    visible: !gameView.engineInstance
+    onClicked: {
+      var engineInstance = hwEngine.runQuickGame()
+      gameView.engineInstance = engineInstance
+    }
   }
-  gameButton.onClicked: {
-    var engineInstance = hwEngine.runQuickGame()
-    gameView.engineInstance = engineInstance
+  button1 {
+    visible: !gameView.engineInstance
+    onClicked: {
+      hwEngine.getPreview()
+    }
   }
-  button1.onClicked: {
-    hwEngine.getPreview()
+
+  Keys.onPressed: {
+    if (event.key === Qt.Key_Enter)
+      gameView.engineInstance.longEvent(EngineInstance.Attack,
+                                        EngineInstance.Set)
+  }
+
+  Keys.onReleased: {
+    if (event.key === Qt.Key_Enter)
+      gameView.engineInstance.longEvent(EngineInstance.Attack,
+                                        EngineInstance.Unset)
   }
 }