Skip to content

Commit 292f8f6

Browse files
committed
Added preferences window open and close animation
1 parent 1d90762 commit 292f8f6

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

scripts/control_create/control_create.gml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ function control_create() {
2525
prev_scale = -1
2626
rw = 0
2727
rh = 0
28+
preferencesalpha = 0
29+
preferencesopen = 0
30+
preferencesclose = 0
2831

2932
// Audio
3033
channels = 256

scripts/draw_window_preferences_f/draw_window_preferences_f.gml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
function draw_window_preferences_f() {
22
// draw_window_preferences_f()
33
var x1, y1, a, b, c, as, nsel, str;
4+
draw_set_alpha(preferencesalpha)
45
curs = cr_default
56
nsel = -1
67
x1 = floor(rw / 2 - 250)
@@ -21,10 +22,7 @@ function draw_window_preferences_f() {
2122
if (mouse_check_button(mb_left)) draw_set_color(12105912)
2223
draw_rectangle(x1 + 1, y1 + 30, x1 + 39, y1 + 69, 0)
2324
if (mouse_check_button_released(mb_left)) {
24-
window = 0
25-
window_set_cursor(curs)
26-
save_settings()
27-
selected_tab = 0
25+
preferencesclose = 1
2826
}
2927
}
3028
draw_sprite(spr_back, 0, x1 + 12, y1 + 30 + 12)
@@ -250,6 +248,35 @@ function draw_window_preferences_f() {
250248
// save_settings()
251249
// selected_tab = 0
252250
//}
253-
251+
if (preferencesopen = 0) {
252+
if (preferencesalpha < 1) {
253+
if (refreshrate = 0) preferencesalpha += 1/3.75
254+
else if (refreshrate = 1) preferencesalpha += 1/7.5
255+
else if (refreshrate = 2) preferencesalpha += 1/15
256+
else if (refreshrate = 3) preferencesalpha += 1/18
257+
else preferencesalpha += 1/20
258+
} else {
259+
preferencesalpha = 1
260+
preferencesopen = 1
261+
}
262+
}
263+
if (preferencesclose = 1) {
264+
if (preferencesalpha > 0) {
265+
if (refreshrate = 0) preferencesalpha -= 1/3.75
266+
else if (refreshrate = 1) preferencesalpha -= 1/7.5
267+
else if (refreshrate = 2) preferencesalpha -= 1/15
268+
else if (refreshrate = 3) preferencesalpha -= 1/18
269+
else preferencesalpha -= 1/20
270+
} else {
271+
preferencesalpha = 0
272+
preferencesclose = 0
273+
preferencesopen = 0
274+
window = 0
275+
window_set_cursor(curs)
276+
save_settings()
277+
selected_tab = 0
278+
}
279+
}
280+
draw_set_alpha(1)
254281

255282
}

0 commit comments

Comments
 (0)