mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-12-17 03:24:43 -05:00
Changing a button's texturerect child no longer requires the theme in its file path
Instead, it automatically finds its path, adds the new file name and loads the new texture.
This commit is contained in:
parent
9ce7bae2f9
commit
55e7178e1f
4 changed files with 28 additions and 43 deletions
12
src/Main.gd
12
src/Main.gd
|
|
@ -597,18 +597,16 @@ func _on_Tool_pressed(tool_pressed : BaseButton, mouse_press := true, key_for_le
|
|||
|
||||
for t in tools:
|
||||
var tool_name : String = t[0].name
|
||||
var theme_type := Global.theme_type
|
||||
if theme_type == "Gold":
|
||||
theme_type = "Dark"
|
||||
var texture_button : TextureRect = t[0].get_child(0)
|
||||
|
||||
if tool_name == Global.current_left_tool and tool_name == Global.current_right_tool:
|
||||
t[0].get_child(0).texture = load("res://assets/graphics/%s_themes/tools/%s_l_r.png" % [theme_type.to_lower(), tool_name.to_lower()])
|
||||
Global.change_button_texturerect(texture_button, "%s_l_r.png" % tool_name.to_lower())
|
||||
elif tool_name == Global.current_left_tool:
|
||||
t[0].get_child(0).texture = load("res://assets/graphics/%s_themes/tools/%s_l.png" % [theme_type.to_lower(), tool_name.to_lower()])
|
||||
Global.change_button_texturerect(texture_button, "%s_l.png" % tool_name.to_lower())
|
||||
elif tool_name == Global.current_right_tool:
|
||||
t[0].get_child(0).texture = load("res://assets/graphics/%s_themes/tools/%s_r.png" % [theme_type.to_lower(), tool_name.to_lower()])
|
||||
Global.change_button_texturerect(texture_button, "%s_r.png" % tool_name.to_lower())
|
||||
else:
|
||||
t[0].get_child(0).texture = load("res://assets/graphics/%s_themes/tools/%s.png" % [theme_type.to_lower(), tool_name.to_lower()])
|
||||
Global.change_button_texturerect(texture_button, "%s.png" % tool_name.to_lower())
|
||||
|
||||
Global.left_cursor_tool_texture.create_from_image(load("res://assets/graphics/cursor_icons/%s_cursor.png" % Global.current_left_tool.to_lower()), 0)
|
||||
Global.right_cursor_tool_texture.create_from_image(load("res://assets/graphics/cursor_icons/%s_cursor.png" % Global.current_right_tool.to_lower()), 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue