equal
deleted
inserted
replaced
1 import QtQuick 2.7 |
1 import QtQuick 2.7 |
|
2 import Hedgewars.Engine 1.0 |
2 |
3 |
3 Page1Form { |
4 Page1Form { |
4 button1.onClicked: { |
5 focus: true |
5 console.log("Button Pressed. Entered text: " + textField1.text); |
6 |
|
7 property HWEngine hwEngine |
|
8 property NetSession netSession |
|
9 |
|
10 Component { |
|
11 id: hwEngineComponent |
|
12 |
|
13 HWEngine { |
|
14 engineLibrary: "./libhedgewars_engine.so" |
|
15 previewAcceptor: PreviewAcceptor |
|
16 onPreviewImageChanged: previewImage.source = "image://preview/image" |
|
17 onPreviewIsRendering: previewImage.source = "qrc:/res/iconTime.png" |
|
18 } |
|
19 } |
|
20 |
|
21 Component { |
|
22 id: netSessionComponent |
|
23 |
|
24 NetSession { |
|
25 nickname: "test0272" |
|
26 url: "hwnet://gameserver.hedgewars.org:46632" |
|
27 } |
|
28 } |
|
29 |
|
30 Component.onCompleted: { |
|
31 hwEngine = hwEngineComponent.createObject() |
|
32 } |
|
33 |
|
34 tickButton { |
|
35 onClicked: { |
|
36 tickButton.visible = false |
|
37 gameView.tick(100) |
|
38 } |
|
39 } |
|
40 gameButton { |
|
41 visible: !gameView.engineInstance |
|
42 onClicked: { |
|
43 var engineInstance = hwEngine.runQuickGame() |
|
44 gameView.engineInstance = engineInstance |
|
45 } |
|
46 } |
|
47 button1 { |
|
48 visible: !gameView.engineInstance |
|
49 onClicked: { |
|
50 hwEngine.getPreview() |
|
51 } |
|
52 } |
|
53 netButton.onClicked: { |
|
54 netSession = netSessionComponent.createObject() |
|
55 netSession.open() |
|
56 } |
|
57 |
|
58 Keys.onPressed: { |
|
59 if (event.key === Qt.Key_Enter) |
|
60 gameView.engineInstance.longEvent(Engine.Attack, Engine.Set) |
|
61 } |
|
62 |
|
63 Keys.onReleased: { |
|
64 if (event.key === Qt.Key_Enter) |
|
65 gameView.engineInstance.longEvent(Engine.Attack, Engine.Unset) |
6 } |
66 } |
7 } |
67 } |