-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.qml
101 lines (85 loc) · 2.51 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import Qt.labs.settings 1.1
import "ui"
import "game"
Window {
id: application
width: 1024
height: 800
visible: true
color: "black"
title: i18n.t("Fallout Equestria")
property bool isFullScreen: true
property bool hasSavedGame: false // TODO
property alias gameLoading: gameLoadManager.gameLoading
property alias currentView: mainView.currentItem
Settings {
id: settings
property alias x: application.x
property alias y: application.y
property alias width: application.width
property alias height: application.height
property alias fullScreen: application.isFullScreen
property int movementMode: gameManager.movementModeOption
property bool withMovementCursor: mouseCursor.withMoveCursor
property bool withPlayerCropCircle: gameManager.withPlayerCropCircle
property real combatSpeed: gameManager.combatSpeedOption
}
onIsFullScreenChanged: updateDisplay()
Component.onCompleted: updateDisplay()
function updateDisplay() {
if (isFullScreen)
application.showFullScreen();
else
application.showNormal();
gameManager.movementModeOption = settings.movementMode;
gameManager.combatSpeedOption = settings.combatSpeed;
mouseCursor.withMoveCursor = settings.withMovementCursor;
}
function createGame() {
pushView("Game.qml");
gameManager.startNewGame();
}
function pushView(path, properties = {}) {
mainView.push(path, properties);
}
function popView() {
mainView.pop();
}
function popAllViews() {
mainView.pop(null);
}
StackView {
id: mainView
initialItem: "MainMenu.qml"
anchors.fill: parent
onCurrentItemChanged: {
if (depth === 1)
musicManager.play("mainmenu");
}
}
GameLoadManager { id: gameLoadManager }
Shortcut {
sequence: "F11"
onActivated: application.isFullScreen = !application.isFullScreen
}
property alias consoleFontName: consoleFont.name
property alias titleFontName: titleFont.name
property var consoleFont: FontStyle {
id: consoleFont
source: i18n.consoleFont
pointSize: i18n.consoleFontMetrics["point"]
tinySize: i18n.consoleFontMetrics["tiny"]
bigSize: i18n.consoleFontMetrics["big"]
hugeSize: bigSize / 3 * 4
}
property var titleFont: FontStyle {
id: titleFont
source: i18n.titleFont
pointSize: i18n.titleFontMetrics["point"]
tinySize: i18n.titleFontMetrics["tiny"]
bigSize: i18n.titleFontMetrics["big"]
}
}