1
- local gui = {leftPanel = {}, rightPanel = {}, scrubbar = {}, left = {}, playback = {}, right = {}, shuffle = {}, loop = {}, volume = {}, fullscreen = {}, graphics = {}, timestamp_start = {}, timestamp_end = {}, scrubhead = {}}
1
+ local gui = {leftPanel = {}, rightPanel = {}, scrubbar = {}, left = {}, playback = {}, right = {}, shuffle = {}, loop = {}, volume = {}, fullscreen = {}, menu = {}, graphics = {}, timestamp_start = {}, timestamp_end = {}, scrubhead = {}}
2
2
local scrubbar_x1 = 0
3
3
local scrubbar_y1 = 0
4
4
local scrubbar_x2 = 0
@@ -17,6 +17,8 @@ local volume_quad = "volume2"
17
17
local fullscreen_x = 0
18
18
local fullscreen_quad = " fullscreen"
19
19
local click_area_y = 0
20
+ local menu_x = 0
21
+ local menu_y = 0
20
22
local scrubhead_radius = 0
21
23
local timestamp_start_x = 0
22
24
local timestamp_start_y = 0
@@ -76,10 +78,11 @@ function gui.load()
76
78
sprite_quads [" volume1" ] = love .graphics .newQuad (480 , 240 , 240 , 240 , mc_image_width , mc_image_height )
77
79
sprite_quads [" volume2" ] = love .graphics .newQuad (720 , 240 , 240 , 240 , mc_image_width , mc_image_height )
78
80
sprite_quads [" volume3" ] = love .graphics .newQuad (0 , 480 , 240 , 240 , mc_image_width , mc_image_height )
81
+ sprite_quads [" menu" ] = love .graphics .newQuad (240 , 480 , 240 , 240 , mc_image_width , mc_image_height )
79
82
sprite_quads [" loop" ] = love .graphics .newQuad (0 , 0 , 300 , 240 , loop_image :getWidth (), loop_image :getHeight ())
80
83
sprite_quads [" shuffle" ] = love .graphics .newQuad (0 , 0 , 300 , 240 , shuffle_image :getWidth (), shuffle_image :getHeight ())
81
84
82
- sprite_batch = love .graphics .newSpriteBatch (music_control_image , 9 )
85
+ sprite_batch = love .graphics .newSpriteBatch (music_control_image , 10 )
83
86
shuffle_sprite = love .graphics .newSpriteBatch (shuffle_image , 1 )
84
87
loop_sprite = love .graphics .newSpriteBatch (loop_image , 1 )
85
88
local gui_scaling_multiplier = math.max (graphics_height , 480 )
@@ -120,7 +123,9 @@ function gui.load()
120
123
121
124
offset = graphics_width - sprite_square_side_length - medium_spacing - small_spacing
122
125
fullscreen_x = offset - medium_spacing
126
+ menu_x = offset - large_spacing
123
127
sprites [" fullscreen" ] = sprite_batch :add (sprite_quads [fullscreen_quad ], offset , right_height , 0 , scale_x * .93 )
128
+ sprites [" menu" ] = sprite_batch :add (sprite_quads [" menu" ], offset , 10 , 0 , scale_x )
124
129
offset = offset - sprite_square_side_length - large_spacing - small_spacing / 2
125
130
volume_x = offset - 3 * small_spacing / 2
126
131
sprites [" volume" ] = sprite_batch :add (sprite_quads [volume_quad ], offset , right_height , 0 , scale_x )
@@ -147,6 +152,7 @@ function gui.load()
147
152
scrubbar_y2 = ui_height
148
153
149
154
click_area_y = graphics_height - gui_scaling_multiplier / 16
155
+ menu_y = scale_x * 240 + 10 + medium_spacing
150
156
---- --------------------------------------------------------------------------------
151
157
end
152
158
@@ -188,7 +194,9 @@ function gui.scale()
188
194
189
195
offset = graphics_width - sprite_square_side_length - medium_spacing - small_spacing
190
196
fullscreen_x = offset - medium_spacing
197
+ menu_x = offset - large_spacing
191
198
sprite_batch :set (sprites [" fullscreen" ], sprite_quads [fullscreen_quad ], offset , right_height , 0 , scale_x * .93 )
199
+ sprite_batch :set (sprites [" menu" ], sprite_quads [" menu" ], offset , 10 , 0 , scale_x )
192
200
offset = offset - sprite_square_side_length - large_spacing - small_spacing / 2
193
201
volume_x = offset - 3 * small_spacing / 2
194
202
sprite_batch :set (sprites [" volume" ], sprite_quads [volume_quad ], offset , right_height , 0 , scale_x )
@@ -215,6 +223,7 @@ function gui.scale()
215
223
scrubbar_y2 = ui_height
216
224
217
225
click_area_y = graphics_height - gui_scaling_multiplier / 16
226
+ menu_y = scale_x * 240 + 10 + medium_spacing
218
227
---- --------------------------------------------------------------------------------
219
228
end
220
229
@@ -481,6 +490,23 @@ function gui.rightPanel:inBoundsX(x)
481
490
return x >= volume_x
482
491
end
483
492
493
+ function gui .menu :inBoundsX (x )
494
+ return x <= graphics_width and x >= menu_x
495
+ end
496
+
497
+ function gui .menu :inBoundsY (y )
498
+ return y >= 0 and y <= menu_y
499
+ end
500
+
501
+ function gui .menu :activate ()
502
+ audio .reload ()
503
+ spectrum .reload ()
504
+ reload ()
505
+
506
+ playback_quad = " pause"
507
+ gui .scale ()
508
+ end
509
+
484
510
function gui .graphics :setHeight (height )
485
511
graphics_height = height
486
512
end
0 commit comments