-
Notifications
You must be signed in to change notification settings - Fork 0
/
theme.qml
167 lines (137 loc) · 3.65 KB
/
theme.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
// vgOS Frontend
import QtQuick 2.11
import QtGraphicalEffects 1.0
import QtMultimedia 5.9
import "qrc:/qmlutils" as PegasusUtils
import "layer_grid"
import "layer_menu"
import "layer_details"
FocusScope {
// Loading the fonts here makes them usable in the rest of the theme
// and can be referred to using their name and weight.
FontLoader { id: titleFont; source: "fonts/AkzidenzGrotesk-BoldCond.otf" }
FontLoader { id: subtitleFont; source: "fonts/Gotham-Bold.otf" }
property bool menuactive: false
Item {
id: everythingcontainer
anchors {
left: parent.left; right: parent.right
top: parent.top; bottom: parent.bottom
}
width: parent.width
height: parent.height
BackgroundImage {
id: backgroundimage
anchors {
left: parent.left; right: parent.right
top: parent.top; bottom: parent.bottom
}
}
Image {
id: menuicon
source: "assets/images/menuicon.svg"
width: vpx(24)
height: vpx(24)
anchors { top: parent.top; topMargin: vpx(32); left: parent.left; leftMargin: vpx(32) }
visible: gamegrid.focus
}
GameGridDetails {
id: content
height: vpx(280)
width: parent.width - vpx(182)
// Text doesn't look so good blurred so fade it out when blurring
opacity: 1
Behavior on opacity { OpacityAnimator { duration: 100 } }
}
Item {
id: gridcontainer
clip: true
width: parent.width
height: parent.height * 0.65
anchors {
top: content.bottom; bottom: parent.bottom
left: parent.left; right: parent.right
}
GameGrid {
id: gamegrid
focus: true
gridWidth: parent.width - vpx(164)
height: parent.height
anchors {
top: parent.top; topMargin: vpx(10)
bottom: parent.bottom;
left: parent.left; right: parent.right
}
onLaunchRequested: api.currentGame.launch()
onNextCollection: api.collections.incrementIndex()
onPrevCollection: api.collections.decrementIndex()
onMenuRequested: toggleMenu()
}
}
}
GameDetails {
id: gamedetails
anchors {
left: parent.left; right: parent.right
top: parent.top; bottom: parent.bottom
}
width: parent.width
height: parent.height
}
PlatformMenu {
id: platformmenu
anchors {
left: parent.left; right: parent.right
top: parent.top; bottom: parent.bottom
}
width: parent.width
height: parent.height
backgroundcontainer: everythingcontainer
onMenuCloseRequested: toggleMenu()
}
function toggleMenu() {
if (platformmenu.focus) {
// Close the menu
gamegrid.focus = true
platformmenu.outro()
content.opacity = 1
} else {
// Open the menu
platformmenu.focus = true
platformmenu.intro()
content.opacity = 0
}
}
// Switch collection overlay
GameGridSwitcher {
id: switchoverlay
anchors.fill: parent
width: parent.width
height: parent.height
}
// Empty area for swiping on touch
Item {
anchors { top: parent.top; left: parent.left; bottom: parent.bottom; }
width: vpx(75)
PegasusUtils.HorizontalSwipeArea {
anchors.fill: parent
visible: gamegrid.focus
onSwipeRight: toggleMenu()
//onSwipeLeft: closeRequested()
onClicked: toggleMenu()
}
}
///////////////////
// SOUND EFFECTS //
///////////////////
SoundEffect {
id: navSound
source: "assets/audio/tap-mellow.wav"
volume: 0.2
}
SoundEffect {
id: menuIntroSound
source: "assets/audio/slide-scissors.wav"
volume: 0.2
}
}