[WIP] Difficulty colors improved

This commit is contained in:
Luke Hubmayer-Werner 2019-11-23 20:53:32 +10:30
parent ad7a49fabf
commit d7d256596e
2 changed files with 28 additions and 9 deletions

View File

@ -29,9 +29,9 @@ const COLOR_TEXT := Color(1, 1, 1, 1)
const COLOR_DIFFICULTY := PoolColorArray([ # Background, foreground for each const COLOR_DIFFICULTY := PoolColorArray([ # Background, foreground for each
Color(0.435, 0.333, 1.000), Color(1.0, 1.0, 1.0), Color(0.435, 0.333, 1.000), Color(1.0, 1.0, 1.0),
Color(0.506, 0.851, 0.333), Color(1.0, 1.0, 1.0), Color(0.150, 1.000, 0.275), Color(1.0, 1.0, 1.0),
Color(0.973, 0.718, 0.039), Color(1.0, 1.0, 1.0), Color(0.973, 0.718, 0.039), Color(1.0, 1.0, 1.0),
Color(1.000, 0.541, 0.584), Color(1.0, 1.0, 1.0), Color(1.000, 0.150, 0.150), Color(1.0, 1.0, 1.0),
Color(0.761, 0.271, 0.902), Color(1.0, 1.0, 1.0), Color(0.761, 0.271, 0.902), Color(1.0, 1.0, 1.0),
Color(1.0, 1.0, 1.0), Color(0.737, 0.188, 0.894), Color(1.0, 1.0, 1.0), Color(0.737, 0.188, 0.894),
]) ])

31
Menu.gd
View File

@ -50,6 +50,10 @@ func _process(delta):
func draw_string_centered(font, position, string, color := Color.white): func draw_string_centered(font, position, string, color := Color.white):
draw_string(font, Vector2(position.x - font.get_string_size(string).x/2.0, position.y + font.get_ascent()), string, color) draw_string(font, Vector2(position.x - font.get_string_size(string).x/2.0, position.y + font.get_ascent()), string, color)
func diffstr(difficulty: float):
# Convert .5 to +
return str(int(floor(difficulty))) + ("+" if fmod(difficulty, 1.0)>0.4 else "")
func _draw(): func _draw():
var songs = len(song_defs) var songs = len(song_defs)
var size = 216 var size = 216
@ -75,22 +79,22 @@ func _draw():
var key = songslist[selected_song%s] var key = songslist[selected_song%s]
var subsize = size * scales[0] var subsize = size * scales[0]
y = gy + spacer_y y = gy + spacer_y
draw_rect(Rect2(-subsize/2.0 - outline_px, y - outline_px, subsize + outline_px*2, subsize + outline_px*2), GameTheme.COLOR_DIFFICULTY[selected_difficulty]) draw_rect(Rect2(-subsize/2.0 - outline_px, y - outline_px, subsize + outline_px*2, subsize + outline_px*2), GameTheme.COLOR_DIFFICULTY[selected_difficulty*2])
draw_texture_rect(song_images[key], Rect2(-subsize/2.0, y, subsize, subsize), false) draw_texture_rect(song_images[key], Rect2(-subsize/2.0, y, subsize, subsize), false)
if selected: if selected:
draw_string_centered(TitleFont, Vector2(0, y+subsize), song_defs[key]["title"], Color(0.95, 0.95, 1.0)) draw_string_centered(TitleFont, Vector2(0, y+subsize), song_defs[key]["title"], Color(0.95, 0.95, 1.0))
draw_string_centered(GenreFont, Vector2(subsize/2.0 - 24, gy+subsize+8), str(song_defs[key]["chart_difficulties"][selected_difficulty]), GameTheme.COLOR_DIFFICULTY[selected_difficulty]) draw_string_centered(GenreFont, Vector2(subsize/2.0 - 24, gy+subsize+8), diffstr(song_defs[key]["chart_difficulties"][selected_difficulty]), GameTheme.COLOR_DIFFICULTY[selected_difficulty*2])
for i in [1, 2, 3]: for i in [1, 2, 3]:
key = songslist[(selected_song+i)%s] key = songslist[(selected_song+i)%s]
subsize = size * scales[i] subsize = size * scales[i]
var gx = size * (cumscales[i] - scales[0]*0.5 - scales[i]*0.5) + spacer_x * i var gx = size * (cumscales[i] - scales[0]*0.5 - scales[i]*0.5) + spacer_x * i
draw_rect(Rect2(gx - subsize/2.0 - outline_px, y - outline_px, subsize + outline_px*2, subsize + outline_px*2), GameTheme.COLOR_DIFFICULTY[selected_difficulty]) draw_rect(Rect2(gx - subsize/2.0 - outline_px, y - outline_px, subsize + outline_px*2, subsize + outline_px*2), GameTheme.COLOR_DIFFICULTY[selected_difficulty*2])
draw_texture_rect(song_images[key], Rect2(gx - subsize/2.0, y, subsize, subsize), false) draw_texture_rect(song_images[key], Rect2(gx - subsize/2.0, y, subsize, subsize), false)
draw_string_centered(GenreFont, Vector2(gx + subsize/2.0 - 24, gy+subsize+8), str(song_defs[key]["chart_difficulties"][selected_difficulty]), GameTheme.COLOR_DIFFICULTY[selected_difficulty]) draw_string_centered(GenreFont, Vector2(gx + subsize/2.0 - 24, gy+subsize+8), diffstr(song_defs[key]["chart_difficulties"][selected_difficulty]), GameTheme.COLOR_DIFFICULTY[selected_difficulty*2])
key = songslist[(selected_song-i)%s] key = songslist[(selected_song-i)%s]
draw_rect(Rect2(-gx - subsize/2.0 - outline_px, y - outline_px, subsize + outline_px*2, subsize + outline_px*2), GameTheme.COLOR_DIFFICULTY[selected_difficulty]) draw_rect(Rect2(-gx - subsize/2.0 - outline_px, y - outline_px, subsize + outline_px*2, subsize + outline_px*2), GameTheme.COLOR_DIFFICULTY[selected_difficulty*2])
draw_texture_rect(song_images[key], Rect2(-gx - subsize/2.0, y, subsize, subsize), false) draw_texture_rect(song_images[key], Rect2(-gx - subsize/2.0, y, subsize, subsize), false)
draw_string_centered(GenreFont, Vector2(-gx + subsize/2.0 - 24, gy+subsize+8), str(song_defs[key]["chart_difficulties"][selected_difficulty]), GameTheme.COLOR_DIFFICULTY[selected_difficulty]) draw_string_centered(GenreFont, Vector2(-gx + subsize/2.0 - 24, gy+subsize+8), diffstr(song_defs[key]["chart_difficulties"][selected_difficulty]), GameTheme.COLOR_DIFFICULTY[selected_difficulty*2])
gy += size + (spacer_y * 2) gy += size + (spacer_y * 2)
# for key in song_images: # for key in song_images:
@ -100,3 +104,18 @@ func _draw():
# if x >= (size + spacer_x)*2: # if x >= (size + spacer_x)*2:
# x = -(size + spacer_x)*2 # x = -(size + spacer_x)*2
# y += size + spacer_y # y += size + spacer_y
func _input(event):
if event.is_action_pressed("ui_right"):
selected_song += 1
if event.is_action_pressed("ui_left"):
selected_song -= 1
if event.is_action_pressed("ui_up"):
selected_genre = int(max(0, selected_genre - 1))
if event.is_action_pressed("ui_down"):
selected_genre = int(min(1, selected_genre + 1))
if event.is_action_pressed("ui_page_up"):
selected_difficulty = int(max(0, selected_difficulty - 1))
if event.is_action_pressed("ui_page_down"):
selected_difficulty = int(min(4, selected_difficulty + 1))