Skip to content

Commit 7944d5d

Browse files
committed
fix: blurry player mode central area on odd screen resolution
1 parent 3965f3a commit 7944d5d

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

scripts/control_draw/control_draw.gml

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ function control_draw() {
1111
rw = floor(window_width * (1 / window_scale))
1212
rh = floor(window_height * (1 / window_scale))
1313

14+
var centerx = floor(rw / 2)
15+
var centery = floor(rh / 2)
16+
1417
// Update window scale
1518
if (window_scale != prev_scale) {
1619
camera_set_view_size(cam_window, rw, rh)
@@ -437,7 +440,7 @@ function control_draw() {
437440
if (fade=0) c += ((selbx = starta + a && selby = startb + b && select = 0 && window = 0 && cursmarker = 0) || s) * 0.5
438441
}
439442
realkey = song_key[starta + a, startb + b] + song_pit[starta + a, startb + b] / 100
440-
draw_block(floor(rw / 2 - (52 * 39) / 2) + floor(19.5 * (realkey + floor(realkey / 12) * 2 + (realkey mod 12 >= 8) + (realkey mod 12 >= 3))) + 4, rh - 154 - a * 32 - 32 + note_offset, song_ins[starta + a, startb + b], song_key[starta + a, startb + b], song_pan[starta + a, startb + b], song_vel[starta + a, startb + b] * (layervol[b] / 100), song_pit[starta + a, startb + b], c, s * 0.8)
443+
draw_block(floor(centerx - (52 * 39) / 2) + floor(19.5 * (realkey + floor(realkey / 12) * 2 + (realkey mod 12 >= 8) + (realkey mod 12 >= 3))) + 4, rh - 154 - a * 32 - 32 + note_offset, song_ins[starta + a, startb + b], song_key[starta + a, startb + b], song_pan[starta + a, startb + b], song_vel[starta + a, startb + b] * (layervol[b] / 100), song_pit[starta + a, startb + b], c, s * 0.8)
441444
}
442445
}
443446
} else {
@@ -1758,18 +1761,18 @@ function control_draw() {
17581761
if (!isplayer) if (draw_icon(icons.SAVE, xx, yy, "Save song", 0, 0)) {save_song(filename)} if (!isplayer) xx += 25 + 4
17591762
draw_separator(xx, yy + 3) xx += 4
17601763
if (draw_icon(icons.PLAY + playing, xx, yy, "Play / Pause song", 0, 0)) toggle_playing(totalcols)
1761-
if (isplayer && !dropmode) if (draw_icon(icons.PLAY + playing, rw / 2 - 12, rh / 2 + 50, "Play / Pause song", 0, 0)) toggle_playing(totalcols)
1764+
if (isplayer && !dropmode) if (draw_icon(icons.PLAY + playing, centerx - 12, centery + 50, "Play / Pause song", 0, 0)) toggle_playing(totalcols)
17621765
xx += 25
17631766
if (draw_icon(icons.STOP, xx, yy, "Stop song", 0, 0)) {playing = 0 marker_pos = 0 marker_prevpos = 0 timestoloop = real(loopmax)} xx += 25
1764-
if (isplayer && !dropmode) if (draw_icon(icons.STOP, rw / 2 - 12 - 100, rh / 2 + 50, "Stop song", 0, 0)) {playing = 0 marker_pos = 0 marker_prevpos = 0 timestoloop = real(loopmax)}
1767+
if (isplayer && !dropmode) if (draw_icon(icons.STOP, centerx - 12 - 100, centery + 50, "Stop song", 0, 0)) {playing = 0 marker_pos = 0 marker_prevpos = 0 timestoloop = real(loopmax)}
17651768
forward = 0
17661769
if (draw_icon(icons.BACK, xx, yy, "Rewind song", 0, 0)) {forward = -1} xx += 25
1767-
if (isplayer && !dropmode) if (draw_icon(icons.BACK, rw / 2 - 12 - 50, rh / 2 + 50, "Rewind song", 0, 0)) {forward = -1}
1770+
if (isplayer && !dropmode) if (draw_icon(icons.BACK, centerx - 12 - 50, centery + 50, "Rewind song", 0, 0)) {forward = -1}
17681771
if (draw_icon(icons.FORWARD, xx, yy, "Fast-forward song", 0, 0)) {forward = 1} xx += 25
1769-
if (isplayer && !dropmode) if (draw_icon(icons.FORWARD, rw / 2 - 12 + 50, rh / 2 + 50, "Fast-forward song", 0, 0)) {forward = 1}
1772+
if (isplayer && !dropmode) if (draw_icon(icons.FORWARD, centerx - 12 + 50, centery + 50, "Fast-forward song", 0, 0)) {forward = 1}
17701773
if (!isplayer) if (draw_icon(icons.RECORD, xx, yy, "Record key presses", 0, playing > 0 && record)) {playing = 0.25 record=!record} if (!isplayer) xx += 25
17711774
if (draw_icon(icons.LOOP_INACTIVE + loop_session, xx, yy, "Toggle looping", 0, 0)) loop_session = !loop_session if (!isplayer) xx += 25
1772-
if (isplayer && !dropmode) if (draw_icon(icons.LOOP_INACTIVE + loop_session, rw / 2 - 12 + 100, rh / 2 + 50, "Toggle looping", 0, 0)) loop_session = !loop_session if (!isplayer)
1775+
if (isplayer && !dropmode) if (draw_icon(icons.LOOP_INACTIVE + loop_session, centerx - 12 + 100, centery + 50, "Toggle looping", 0, 0)) loop_session = !loop_session if (!isplayer)
17731776
if metronome {
17741777
if (metronome_played == -1 || (metronome_played - 1) mod 8 == 0) metricon = icons.METRONOME_1
17751778
else metricon = icons.METRONOME_2
@@ -1791,18 +1794,18 @@ function control_draw() {
17911794
if (!isplayer) if (draw_icon(icons.SAVE, xx, yy, "保存歌曲", 0, 0)) {save_song(filename)} if (!isplayer) xx += 25 + 4
17921795
draw_separator(xx, yy + 3) xx += 4
17931796
if (draw_icon(icons.PLAY + playing, xx, yy, "播放 / 暂停", 0, 0)) toggle_playing(totalcols)
1794-
if (isplayer && !dropmode) if (draw_icon(icons.PLAY + playing, rw / 2 - 12, rh / 2 + 50, "播放 / 暂停", 0, 0)) toggle_playing(totalcols)
1797+
if (isplayer && !dropmode) if (draw_icon(icons.PLAY + playing, centerx - 12, centery + 50, "播放 / 暂停", 0, 0)) toggle_playing(totalcols)
17951798
xx += 25
17961799
if (draw_icon(icons.STOP, xx, yy, "停止歌曲", 0, 0)) {playing = 0 marker_pos = 0 marker_prevpos = 0 timestoloop = real(loopmax)} xx += 25
1797-
if (isplayer && !dropmode) if (draw_icon(icons.STOP, rw / 2 - 12 - 100, rh / 2 + 50, "停止歌曲", 0, 0)) {playing = 0 marker_pos = 0 marker_prevpos = 0 timestoloop = real(loopmax)}
1800+
if (isplayer && !dropmode) if (draw_icon(icons.STOP, centerx - 12 - 100, centery + 50, "停止歌曲", 0, 0)) {playing = 0 marker_pos = 0 marker_prevpos = 0 timestoloop = real(loopmax)}
17981801
forward = 0
17991802
if (draw_icon(icons.BACK, xx, yy, "快退", 0, 0)) {forward = -1} xx += 25
1800-
if (isplayer && !dropmode) if (draw_icon(icons.BACK, rw / 2 - 12 - 50, rh / 2 + 50, "快退", 0, 0)) {forward = -1}
1803+
if (isplayer && !dropmode) if (draw_icon(icons.BACK, centerx - 12 - 50, centery + 50, "快退", 0, 0)) {forward = -1}
18011804
if (draw_icon(icons.FORWARD, xx, yy, "快进", 0, 0)) {forward = 1} xx += 25
1802-
if (isplayer && !dropmode) if (draw_icon(icons.FORWARD, rw / 2 - 12 + 50, rh / 2 + 50, "快进", 0, 0)) {forward = 1}
1805+
if (isplayer && !dropmode) if (draw_icon(icons.FORWARD, centerx - 12 + 50, centery + 50, "快进", 0, 0)) {forward = 1}
18031806
if (!isplayer) if (draw_icon(icons.RECORD, xx, yy, "录制按键", 0, playing > 0 && record)) {playing = 0.25 record=!record} if (!isplayer) xx += 25
18041807
if (draw_icon(icons.LOOP_INACTIVE + loop_session, xx, yy, "开关循环", 0, 0)) loop_session = !loop_session if (!isplayer) xx += 25
1805-
if (isplayer && !dropmode) if (draw_icon(icons.LOOP_INACTIVE + loop_session, rw / 2 - 12 + 100, rh / 2 + 50, "开关循环", 0, 0)) loop_session = !loop_session if (!isplayer)
1808+
if (isplayer && !dropmode) if (draw_icon(icons.LOOP_INACTIVE + loop_session, centerx - 12 + 100, centery + 50, "开关循环", 0, 0)) loop_session = !loop_session if (!isplayer)
18061809
if metronome {
18071810
if (metronome_played == -1 || (metronome_played - 1) mod 8 == 0) metricon = icons.METRONOME_1
18081811
else metricon = icons.METRONOME_2
@@ -2182,8 +2185,8 @@ function control_draw() {
21822185
else draw_text_dynamic(93 - 84, 52, time_str(marker_pos / tempo))
21832186
} else {
21842187
draw_theme_font(font_info_big)
2185-
if (theme != 3) draw_text_dynamic(rw / 2 + 70, rh / 2 - 50, time_str(marker_pos / tempo))
2186-
else draw_text_dynamic(rw / 2 - 134 + 70, rh / 2 - 50, time_str(marker_pos / tempo))
2188+
if (theme != 3) draw_text_dynamic(centerx + 70, centery - 50, time_str(marker_pos / tempo))
2189+
else draw_text_dynamic(centerx - 134 + 70, centery - 50, time_str(marker_pos / tempo))
21872190
}
21882191

21892192
// Song length
@@ -2194,28 +2197,29 @@ function control_draw() {
21942197
} else {
21952198
if (blackout) draw_set_color(c_white)
21962199
draw_theme_font(font_info_med)
2197-
if (theme != 3) draw_text_dynamic(rw / 2 + 70, rh / 2 - 20, "/ " + time_str(enda / tempo))
2198-
else draw_text_dynamic(rw / 2 - 91 + 70, rh / 2 - 20, "/ " + time_str(enda / tempo))
2200+
if (theme != 3) draw_text_dynamic(centerx + 70, centery - 20, "/ " + time_str(enda / tempo))
2201+
else draw_text_dynamic(centerx - 91 + 70, centery - 20, "/ " + time_str(enda / tempo))
21992202
}
22002203
draw_theme_font(font_main)
22012204
draw_set_halign(fa_left)
22022205
draw_set_alpha(1)
22032206

22042207
if (isplayer) {
22052208
if (!dropmode) {
2206-
marker_pos = draw_dragbar(marker_pos, enda + totalcols, rw / 2 - 200, rh / 2 + 25, 400, 1, time_str((clamp(((mouse_x - (rw / 2 - 200)) / 400) * enda, 0, enda)) / tempo), condstr(language != 1, "Song Position", "当前位置"), 0)
2209+
2210+
marker_pos = draw_dragbar(marker_pos, enda + totalcols, centerx - 200, centery + 25, 400, 1, time_str((clamp(((mouse_x - (centerx - 200)) / 400) * enda, 0, enda)) / tempo), condstr(language != 1, "Song Position", "当前位置"), 0)
22072211
draw_set_halign(fa_left)
22082212
draw_theme_color()
22092213
if (blackout) draw_set_color(c_white)
22102214
draw_theme_font(font_info_med)
2211-
draw_text_dynamic(rw / 2 - 200, rh / 2 - 110, song_name == "" ? song_name : condstr((protocol_data != pointer_null), song_download_display_name, condstr(filename != "-player", filename_change_ext(filename_name(filename), "")) + condstr((filename = "" || filename = "-player") && midiname != "", filename_change_ext(midiname, "")), true))
2215+
draw_text_dynamic(centerx - 200, centery - 110, song_name == "" ? song_name : condstr((protocol_data != pointer_null), song_download_display_name, condstr(filename != "-player", filename_change_ext(filename_name(filename), "")) + condstr((filename = "" || filename = "-player") && midiname != "", filename_change_ext(midiname, "")), true))
22122216
draw_theme_font(font_main_bold)
2213-
draw_text_dynamic(rw / 2 - 200, rh / 2 - 90, song_author, true)
2217+
draw_text_dynamic(centerx - 200, centery - 90, song_author, true)
22142218
draw_theme_font(font_main)
22152219
draw_set_color(c_gray)
2216-
draw_text_dynamic(rw / 2 - 200, rh / 2 - 75, (language != 1 ? "original by " : "original by "), true)
2220+
draw_text_dynamic(centerx - 200, centery - 75, (language != 1 ? "original by " : "original by "), true)
22172221
draw_theme_font(font_main_bold)
2218-
draw_text_dynamic(rw / 2 - 200 + string_width_dynamic(language != 1 ? "original by " : "original by "), rh / 2 - 75, song_orauthor, true)
2222+
draw_text_dynamic(centerx - 200 + string_width_dynamic(language != 1 ? "original by " : "original by "), centery - 75, song_orauthor, true)
22192223
draw_theme_font(font_main)
22202224
draw_set_color(c_white)
22212225
dropalpha = 1

0 commit comments

Comments
 (0)