improve menu visuals

This commit is contained in:
interfisch 2024-12-22 14:27:13 +01:00
parent 0246aa93e3
commit 422414fbfd
7 changed files with 76 additions and 31 deletions

View file

@ -141,12 +141,14 @@ motion_mode = 1
script = ExtResource("1_i5tet")
[node name="sprite_features" type="Sprite2D" parent="CharacterBody_Car"]
visible = false
z_index = 10
texture_filter = 1
scale = Vector2(0.5, 0.5)
texture = ExtResource("3_k2wmt")
[node name="sprite_body" type="Sprite2D" parent="CharacterBody_Car"]
visible = false
z_index = 10
texture_filter = 1
scale = Vector2(0.5, 0.5)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://drgqjl330tj2p"
path="res://.godot/imported/no_preview.png-f86382d97f542fbe5004e6b0043a9cfc.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://scenes/map_preview/no_preview.png"
dest_files=["res://.godot/imported/no_preview.png-f86382d97f542fbe5004e6b0043a9cfc.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=3 uid="uid://b1uhymisifcho"]
[gd_scene load_steps=17 format=3 uid="uid://b1uhymisifcho"]
[ext_resource type="Script" path="res://scripts/menu.gd" id="1_fushn"]
[ext_resource type="Script" path="res://scripts/menudisplay.gd" id="2_jc4pv"]
@ -11,6 +11,7 @@
[ext_resource type="Script" path="res://scripts/rounds_selection.gd" id="7_cr4tq"]
[ext_resource type="Texture2D" uid="uid://dku8jinmijays" path="res://scenes/map_preview/map_04.png" id="8_46b6b"]
[ext_resource type="Texture2D" uid="uid://bst8p5s1sgurm" path="res://sprites/menu_bg.png" id="10_equk1"]
[ext_resource type="Texture2D" uid="uid://drgqjl330tj2p" path="res://scenes/map_preview/no_preview.png" id="11_3sx36"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_kpdum"]
shader = ExtResource("3_vry7a")
@ -68,13 +69,6 @@ scale = Vector2(2.65635, 2.65635)
texture = ExtResource("10_equk1")
offset = Vector2(0.92, 14.62)
[node name="Playerlist" type="Label" parent="MenuDisplay"]
offset_left = 131.0
offset_top = 58.0
offset_right = 745.0
offset_bottom = 572.0
theme_override_font_sizes/font_size = 32
[node name="countdown" type="Label" parent="MenuDisplay"]
offset_left = 114.0
offset_top = 71.0
@ -85,63 +79,63 @@ text = "5"
[node name="MarginContainer" type="MarginContainer" parent="MenuDisplay"]
offset_left = 317.0
offset_top = 90.0
offset_right = 357.0
offset_bottom = 130.0
offset_top = 51.245
offset_right = 515.0
offset_bottom = 637.245
[node name="VBoxContainer_Playerlist" type="VBoxContainer" parent="MenuDisplay/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_font_sizes/font_size = 40
text = "Press key"
uppercase = true
[node name="Label2" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_font_sizes/font_size = 40
text = "to join"
uppercase = true
[node name="Label3" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_font_sizes/font_size = 40
uppercase = true
[node name="Label4" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_font_sizes/font_size = 40
uppercase = true
[node name="Label5" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_font_sizes/font_size = 40
uppercase = true
[node name="Label6" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_font_sizes/font_size = 40
uppercase = true
[node name="Label7" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_font_sizes/font_size = 40
uppercase = true
[node name="Label8" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_font_sizes/font_size = 40
uppercase = true
[node name="Label9" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_font_sizes/font_size = 40
uppercase = true
[node name="Label10" type="Label" parent="MenuDisplay/MarginContainer/VBoxContainer_Playerlist"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_font_sizes/font_size = 40
uppercase = true
[node name="btn_fullscreen" type="CheckButton" parent="MenuDisplay"]
@ -150,9 +144,10 @@ offset_top = 540.0
offset_right = 972.0
offset_bottom = 571.0
scale = Vector2(2, 2)
theme_override_constants/outline_size = 10
text = "Fullscreen"
[node name="Button" type="Button" parent="MenuDisplay"]
[node name="btn_save_whitelist" type="Button" parent="MenuDisplay"]
offset_left = 862.0
offset_top = 602.0
offset_right = 1011.0
@ -195,7 +190,7 @@ icon = ExtResource("8_46b6b")
[node name="btn_map_05" type="Button" parent="MenuDisplay/map_container"]
layout_mode = 2
toggle_mode = true
icon = ExtResource("3_p822h")
icon = ExtResource("11_3sx36")
[node name="rounds_selection" type="OptionButton" parent="MenuDisplay"]
offset_left = 690.0
@ -220,6 +215,7 @@ offset_left = -70.0
offset_top = 3.0
offset_right = -7.0
offset_bottom = 26.0
theme_override_constants/outline_size = 10
text = "Rounds:"
[node name="AnimationPlayer" type="AnimationPlayer" parent="MenuDisplay"]
@ -232,7 +228,7 @@ autoplay = "menu_idle"
wait_time = 5.0
[connection signal="toggled" from="MenuDisplay/btn_fullscreen" to="." method="_on_btn_fullscreen_toggled"]
[connection signal="pressed" from="MenuDisplay/Button" to="." method="_on_button_pressed"]
[connection signal="pressed" from="MenuDisplay/btn_save_whitelist" to="." method="_on_button_pressed"]
[connection signal="map_changed" from="MenuDisplay/map_container" to="." method="_on_map_container_map_changed"]
[connection signal="item_selected" from="MenuDisplay/rounds_selection" to="." method="_on_rounds_selection_item_selected"]
[connection signal="item_selected" from="MenuDisplay/rounds_selection" to="MenuDisplay/rounds_selection" method="_on_item_selected"]

View file

@ -2,7 +2,7 @@ extends Node
@onready var countdown: Label = $MenuDisplay/countdown
@onready var btn_fullscreen = $MenuDisplay/btn_fullscreen
@onready var btn_save_whitelist= $MenuDisplay/btn_save_whitelist
var keywhitelist
func _ready():
@ -15,9 +15,12 @@ func _ready():
btn_fullscreen.button_pressed=ConfigFileHandler.get_video_setting("fullscreen")
keywhitelist=ConfigFileHandler.get_keywhitelist_setting() #empty list if disabled
btn_save_whitelist.disabled=keywhitelist.size()>0 #whitelist enabled, then disable save whitelist button
btn_save_whitelist.visible=!keywhitelist.size()>0
print("Loaded Keywhitelist="+str(keywhitelist))
if keywhitelist.size()>0: #add whitelisted players if whitelist enabled and remove them afterwards to preset colors
#Preload players to set colors
if keywhitelist.size()>0: #add whitelisted players if whitelist enabled and remove them afterwards
for k in keywhitelist:
Gamestate.addPlayer(k)
Gamestate.removeAllPlayers()
@ -46,9 +49,9 @@ func _unhandled_key_input(event: InputEvent) -> void:
print("Key keycode:"+str(event.keycode))
var addedID=Gamestate.addPlayer(event.keycode)
$MenuDisplay.update_playerlist(Gamestate.players)
$MenuDisplay.update_playerlist(Gamestate.players,event.keycode)
if addedID!=-1:
if addedID!=-1: #player was added
if len(Gamestate.getPlayerkeys())>=1:
$Timer.start()
else:
@ -83,7 +86,7 @@ func _on_btn_fullscreen_toggled(toggled_on: bool) -> void:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
#ConfigFileHandler.save_video_setting("fullscreen", toggled_on)
ConfigFileHandler.save_video_setting("fullscreen", toggled_on)
func _on_rounds_selection_item_selected(index: int) -> void:

View file

@ -15,8 +15,7 @@ func updateCountdown(t):
$countdown.text=str(t)
func update_playerlist(players:Array[Gamestate.Player]):
$Playerlist.text=""
func update_playerlist(players:Array[Gamestate.Player],flashplayer_keycode=-1):
var Playerlabels=$MarginContainer/VBoxContainer_Playerlist.get_children()
var i=0
for label in Playerlabels:
@ -24,7 +23,18 @@ func update_playerlist(players:Array[Gamestate.Player]):
if i<len(players):
var p=players[i]
label.text=str(OS.get_keycode_string(p.inputkey))
if (p.inputkey==flashplayer_keycode): #this player pressed their key again
var outlinesize=min(max(0,label.get_theme_constant("outline_size")+30),60)
label.add_theme_constant_override("outline_size",outlinesize)
label.set("theme_override_colors/font_color",p.color)
else:
label.text=""
i+=1
func _process(delta: float) -> void:
var Playerlabels=$MarginContainer/VBoxContainer_Playerlist.get_children()
for label in Playerlabels:
var outlinesize=max(0,label.get_theme_constant("outline_size")-2*delta)
label.add_theme_constant_override("outline_size",outlinesize)