author | Wuzzy <Wuzzy2@mail.ru> |
Wed, 16 Jan 2019 23:43:23 +0100 | |
changeset 14618 | 7c5a9c1b9d4e |
parent 14372 | b6824a53d4b1 |
child 14854 | aed75d439027 |
permissions | -rw-r--r-- |
12854 | 1 |
import QtQuick 2.7 |
14143 | 2 |
import Hedgewars.Engine 1.0 |
12854 | 3 |
|
4 |
Page1Form { |
|
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
5 |
property var hwEngine |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
6 |
|
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
7 |
Component { |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
8 |
id: hwEngineComponent |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
9 |
|
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
10 |
HWEngine { |
14372
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14371
diff
changeset
|
11 |
engineLibrary: "./libhedgewars_engine.so" |
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
12 |
previewAcceptor: PreviewAcceptor |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
13 |
onPreviewImageChanged: previewImage.source = "image://preview/image" |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
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:
14298
diff
changeset
|
15 |
} |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
16 |
} |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
17 |
|
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
18 |
Component.onCompleted: { |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
19 |
hwEngine = hwEngineComponent.createObject() |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
20 |
} |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
21 |
|
14143 | 22 |
tickButton.onClicked: { |
14294
21be7838a127
Add advance_simulation() function to engine lib, some WIP on frontend
unc0rr
parents:
14154
diff
changeset
|
23 |
gameView.tick(100) |
14143 | 24 |
} |
25 |
gameButton.onClicked: { |
|
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
26 |
var engineInstance = hwEngine.runQuickGame() |
14298 | 27 |
gameView.engineInstance = engineInstance |
14143 | 28 |
} |
12854 | 29 |
button1.onClicked: { |
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
30 |
hwEngine.getPreview() |
12854 | 31 |
} |
32 |
} |