aboutsummaryrefslogtreecommitdiff
path: root/game/src/Utility/StyleBoxWithSound.gd
diff options
context:
space:
mode:
author Spartan322 <Megacake1234@gmail.com>2023-06-03 20:37:10 +0200
committer Spartan322 <Megacake1234@gmail.com>2023-06-03 20:37:10 +0200
commitcef940108fe15752c3ef66f43f5169403fa2f71d (patch)
treefe4de5a05830e3bddeae78f74f729503b7cee1e9 /game/src/Utility/StyleBoxWithSound.gd
parent73e29d02e48739aba5ca5db1b9575c67e795400f (diff)
Reorganize the file structure of the files in `game/src`
Diffstat (limited to 'game/src/Utility/StyleBoxWithSound.gd')
-rw-r--r--game/src/Utility/StyleBoxWithSound.gd34
1 files changed, 0 insertions, 34 deletions
diff --git a/game/src/Utility/StyleBoxWithSound.gd b/game/src/Utility/StyleBoxWithSound.gd
deleted file mode 100644
index 8c29b34..0000000
--- a/game/src/Utility/StyleBoxWithSound.gd
+++ /dev/null
@@ -1,34 +0,0 @@
-## WARNING: This will not work with togglable UI elements, a special implementation is needed for them.
-@tool
-extends StyleBox
-class_name StyleBoxWithSound
-
-@export
-var style_box : StyleBox:
- get: return style_box
- set(v):
- style_box = v
- emit_changed()
-
-@export
-var sound : AudioStream:
- get: return sound
- set(v):
- sound = v
- emit_changed()
-
-func _get_draw_rect(rect : Rect2) -> Rect2:
- if style_box == null: return Rect2()
- return style_box._get_draw_rect(rect)
-
-func _draw(to_canvas_item : RID, rect : Rect2) -> void:
- # This is a hack
- # Works fine for simple non-normal style cases
- # Normal styles being drawn immediately tho will trigger sound on startup
- # This would require further work to be applicable for release sounds
- # Is there any other reason aside from release sounds (might be useful for toggles?)
- # This should be fast enough to not cause draw issues
- if sound != null:
- SoundManager.play_effect_stream(sound)
- if style_box != null:
- style_box.draw(to_canvas_item, rect)