qmlfrontend/Page1.qml
author Wuzzy <Wuzzy2@mail.ru>
Thu, 03 Jan 2019 19:46:48 +0100
changeset 14535 5ac181cb2396
parent 14393 b6824a53d4b1
child 14875 aed75d439027
permissions -rw-r--r--
Fix bee targeting fail across wrap world edge Previously, the bee always aimed for the light area, no matter where you actually put the target. It also got confused whenever it flew across the wrap world edge. How the bee works now: 1) The placed bee target is *not* recalculated when it was placed in the "gray" part of the wrap world edge. This allows for more fine-tuning. 1a) Place target in light area: bee aims for target light area 1b) Place target in gray area: bee aims for target, but flies to gray area first 2) Bee target is recalculated whenever bee passes the wrap world edge.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12854
28cb18c5e712 Add new qmlfrontend project template
unc0rr
parents:
diff changeset
     1
import QtQuick 2.7
14164
745c73e0e644 Start working on frontend to rust engine rewrite
unC0Rr
parents: 12854
diff changeset
     2
import Hedgewars.Engine 1.0
12854
28cb18c5e712 Add new qmlfrontend project template
unc0rr
parents:
diff changeset
     3
28cb18c5e712 Add new qmlfrontend project template
unc0rr
parents:
diff changeset
     4
Page1Form {
14392
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
     5
  property var hwEngine
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
     6
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
     7
  Component {
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
     8
    id: hwEngineComponent
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
     9
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
    10
    HWEngine {
14393
b6824a53d4b1 Allow to instantiate HWEngine with different library binaries
unC0Rr
parents: 14392
diff changeset
    11
      engineLibrary: "./libhedgewars_engine.so"
14392
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
    12
      previewAcceptor: PreviewAcceptor
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
    13
      onPreviewImageChanged: previewImage.source = "image://preview/image"
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
    14
      onPreviewIsRendering: previewImage.source = "qrc:/res/iconTime.png"
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
    15
    }
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
    16
  }
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
    17
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
    18
  Component.onCompleted: {
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
    19
    hwEngine = hwEngineComponent.createObject()
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
    20
  }
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
    21
14164
745c73e0e644 Start working on frontend to rust engine rewrite
unC0Rr
parents: 12854
diff changeset
    22
  tickButton.onClicked: {
14315
21be7838a127 Add advance_simulation() function to engine lib, some WIP on frontend
unc0rr
parents: 14175
diff changeset
    23
    gameView.tick(100)
14164
745c73e0e644 Start working on frontend to rust engine rewrite
unC0Rr
parents: 12854
diff changeset
    24
  }
745c73e0e644 Start working on frontend to rust engine rewrite
unC0Rr
parents: 12854
diff changeset
    25
  gameButton.onClicked: {
14392
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
    26
    var engineInstance = hwEngine.runQuickGame()
14319
00b56ec8b7df Pass opengl context to engine
unC0Rr
parents: 14315
diff changeset
    27
    gameView.engineInstance = engineInstance
14164
745c73e0e644 Start working on frontend to rust engine rewrite
unC0Rr
parents: 12854
diff changeset
    28
  }
12854
28cb18c5e712 Add new qmlfrontend project template
unc0rr
parents:
diff changeset
    29
  button1.onClicked: {
14392
90bd2c331703 Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents: 14319
diff changeset
    30
    hwEngine.getPreview()
12854
28cb18c5e712 Add new qmlfrontend project template
unc0rr
parents:
diff changeset
    31
  }
28cb18c5e712 Add new qmlfrontend project template
unc0rr
parents:
diff changeset
    32
}