qmlfrontend/Page1.qml
changeset 14859 aed75d439027
parent 14377 b6824a53d4b1
child 14920 a3ad06ac390e
equal deleted inserted replaced
14858:b96ba3c1ab67 14859:aed75d439027
     1 import QtQuick 2.7
     1 import QtQuick 2.7
     2 import Hedgewars.Engine 1.0
     2 import Hedgewars.Engine 1.0
     3 
     3 
     4 Page1Form {
     4 Page1Form {
     5   property var hwEngine
     5   focus: true
       
     6 
       
     7   property HWEngine hwEngine
     6 
     8 
     7   Component {
     9   Component {
     8     id: hwEngineComponent
    10     id: hwEngineComponent
     9 
    11 
    10     HWEngine {
    12     HWEngine {
    17 
    19 
    18   Component.onCompleted: {
    20   Component.onCompleted: {
    19     hwEngine = hwEngineComponent.createObject()
    21     hwEngine = hwEngineComponent.createObject()
    20   }
    22   }
    21 
    23 
    22   tickButton.onClicked: {
    24   tickButton {
    23     gameView.tick(100)
    25     onClicked: {
       
    26       tickButton.visible = false
       
    27       gameView.tick(100)
       
    28     }
    24   }
    29   }
    25   gameButton.onClicked: {
    30   gameButton {
    26     var engineInstance = hwEngine.runQuickGame()
    31     visible: !gameView.engineInstance
    27     gameView.engineInstance = engineInstance
    32     onClicked: {
       
    33       var engineInstance = hwEngine.runQuickGame()
       
    34       gameView.engineInstance = engineInstance
       
    35     }
    28   }
    36   }
    29   button1.onClicked: {
    37   button1 {
    30     hwEngine.getPreview()
    38     visible: !gameView.engineInstance
       
    39     onClicked: {
       
    40       hwEngine.getPreview()
       
    41     }
       
    42   }
       
    43 
       
    44   Keys.onPressed: {
       
    45     if (event.key === Qt.Key_Enter)
       
    46       gameView.engineInstance.longEvent(EngineInstance.Attack,
       
    47                                         EngineInstance.Set)
       
    48   }
       
    49 
       
    50   Keys.onReleased: {
       
    51     if (event.key === Qt.Key_Enter)
       
    52       gameView.engineInstance.longEvent(EngineInstance.Attack,
       
    53                                         EngineInstance.Unset)
    31   }
    54   }
    32 }
    55 }