--- a/qmlfrontend/Page1.qml Tue Feb 04 15:53:16 2025 +0100
+++ b/qmlfrontend/Page1.qml Tue Feb 04 17:31:55 2025 +0100
@@ -1,25 +1,8 @@
import QtQuick
-import Hedgewars.Engine 1.0
+import Hedgewars 1.0
Page1Form {
property HWEngine hwEngine
- property var keyBindings: ({
- "long": {
- [Qt.Key_Space]: Engine.Attack,
- [Qt.Key_Up]: Engine.ArrowUp,
- [Qt.Key_Right]: Engine.ArrowRight,
- [Qt.Key_Down]: Engine.ArrowDown,
- [Qt.Key_Left]: Engine.ArrowLeft,
- [Qt.Key_Shift]: Engine.Precision
- },
- "simple": {
- [Qt.Key_Tab]: Engine.SwitchHedgehog,
- [Qt.Key_Enter]: Engine.LongJump,
- [Qt.Key_Backspace]: Engine.HighJump,
- [Qt.Key_Y]: Engine.Accept,
- [Qt.Key_N]: Engine.Deny
- }
- })
property NetSession netSession
focus: true
@@ -27,32 +10,7 @@
Component.onCompleted: {
hwEngine = hwEngineComponent.createObject();
}
- Keys.onPressed: event => {
- if (event.isAutoRepeat) {
- return;
- }
- let action = keyBindings["simple"][event.key];
- if (action !== undefined) {
- gameView.engineInstance.simpleEvent(action);
- event.accepted = true;
- return;
- }
- action = keyBindings["long"][event.key];
- if (action !== undefined) {
- gameView.engineInstance.longEvent(action, Engine.Set);
- event.accepted = true;
- }
- }
- Keys.onReleased: event => {
- if (event.isAutoRepeat) {
- return;
- }
- const action = keyBindings["long"][event.key];
- if (action !== undefined) {
- gameView.engineInstance.longEvent(action, Engine.Unset);
- event.accepted = true;
- }
- }
+
netButton.onClicked: {
netSession = netSessionComponent.createObject();
netSession.open();