aboutsummaryrefslogtreecommitdiff
path: root/game/src/Utility
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
parent73e29d02e48739aba5ca5db1b9575c67e795400f (diff)
Reorganize the file structure of the files in `game/src`
Diffstat (limited to 'game/src/Utility')
-rw-r--r--game/src/Utility/GIT_INFO.gd9
-rw-r--r--game/src/Utility/StyleBoxCombinedTexture.gd47
-rw-r--r--game/src/Utility/StyleBoxWithSound.gd34
-rw-r--r--game/src/Utility/TextureSetting.gd123
4 files changed, 0 insertions, 213 deletions
diff --git a/game/src/Utility/GIT_INFO.gd b/game/src/Utility/GIT_INFO.gd
deleted file mode 100644
index eddb7a1..0000000
--- a/game/src/Utility/GIT_INFO.gd
+++ /dev/null
@@ -1,9 +0,0 @@
-### IMPORTANT: IF LOCATION IS CHANGED, PLEASE UPDATE IN addon/openvic-plugin/ReleaseExportEditorPlugin
-class_name _GIT_INFO_
-extends RefCounted
-
-
-const commit_hash : StringName = &"0000000000000000000000000000000000000000"
-const short_hash : StringName = &"0000000"
-const tag : StringName = &"<tag missing>"
-const release_name : StringName = &"<release name missing>"
diff --git a/game/src/Utility/StyleBoxCombinedTexture.gd b/game/src/Utility/StyleBoxCombinedTexture.gd
deleted file mode 100644
index db54da4..0000000
--- a/game/src/Utility/StyleBoxCombinedTexture.gd
+++ /dev/null
@@ -1,47 +0,0 @@
-@tool
-extends StyleBox
-class_name StyleBoxCombinedTexture
-
-@export
-var texture_settings : Array[TextureSetting] = []:
- get: return texture_settings.duplicate()
- set(v):
- texture_settings = v
- for setting in texture_settings:
- setting.changed.connect(emit_changed)
- emit_changed()
-
-func _get_draw_rect(rect : Rect2) -> Rect2:
- var combined_rect : Rect2 = Rect2()
- for setting in texture_settings:
- if combined_rect.position.x > setting.expand_margin_left:
- combined_rect.position.x = setting.expand_margin_left
- if combined_rect.position.y > setting.expand_margin_top:
- combined_rect.position.y = setting.expand_margin_top
- if combined_rect.end.x < setting.expand_margin_right:
- combined_rect.end.x = setting.expand_margin_right
- if combined_rect.end.y < setting.expand_margin_bottom:
- combined_rect.end.y = setting.expand_margin_bottom
- return rect.grow_individual(combined_rect.position.x, combined_rect.position.y, combined_rect.end.x, combined_rect.end.y)
-
-func _draw(to_canvas_item : RID, rect : Rect2) -> void:
- for setting in texture_settings:
- if setting == null or setting.texture == null:
- continue
- var inner_rect : Rect2 = rect
- inner_rect.position.x -= setting.expand_margin_left
- inner_rect.position.y -= setting.expand_margin_top
- inner_rect.size.x += setting.expand_margin_left + setting.expand_margin_right
- inner_rect.size.y += setting.expand_margin_top + setting.expand_margin_bottom
- RenderingServer.canvas_item_add_nine_patch(
- to_canvas_item,
- inner_rect,
- setting.region_rect,
- setting.texture.get_rid(),
- Vector2(setting.texture_margin_left, setting.texture_margin_top),
- Vector2(setting.texture_margin_right, setting.texture_margin_bottom),
- setting.axis_stretch_horizontal,
- setting.axis_stretch_vertical,
- setting.draw_center,
- setting.modulate_color
- )
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)
diff --git a/game/src/Utility/TextureSetting.gd b/game/src/Utility/TextureSetting.gd
deleted file mode 100644
index da9b185..0000000
--- a/game/src/Utility/TextureSetting.gd
+++ /dev/null
@@ -1,123 +0,0 @@
-extends Resource
-class_name TextureSetting
-
-@export
-var texture : Texture2D:
- get: return texture
- set(v):
- texture = v
- emit_changed()
-@export
-var draw_center : bool = true:
- get: return draw_center
- set(v):
- draw_center = v
- emit_changed()
-
-@export_group("Texture Margins", "texture_margin_")
-@export
-var texture_margin_left : float = 0:
- get: return texture_margin_left
- set(v):
- texture_margin_left = v
- emit_changed()
-@export
-var texture_margin_top : float = 0:
- get: return texture_margin_top
- set(v):
- texture_margin_top = v
- emit_changed()
-@export
-var texture_margin_right : float = 0:
- get: return texture_margin_right
- set(v):
- texture_margin_right = v
- emit_changed()
-@export
-var texture_margin_bottom : float = 0:
- get: return texture_margin_bottom
- set(v):
- texture_margin_bottom = v
- emit_changed()
-
-@export_group("Expand Margins", "expand_margin_")
-@export
-var expand_margin_left : float = 0:
- get: return expand_margin_left
- set(v):
- expand_margin_left = v
- emit_changed()
-@export
-var expand_margin_top : float = 0:
- get: return expand_margin_top
- set(v):
- expand_margin_top = v
- emit_changed()
-@export
-var expand_margin_right : float = 0:
- get: return expand_margin_right
- set(v):
- expand_margin_right = v
- emit_changed()
-@export
-var expand_margin_bottom : float = 0:
- get: return expand_margin_bottom
- set(v):
- expand_margin_bottom = v
- emit_changed()
-
-@export_group("Axis Stretch", "axis_stretch_")
-@export
-var axis_stretch_horizontal : RenderingServer.NinePatchAxisMode = RenderingServer.NINE_PATCH_STRETCH:
- get: return axis_stretch_horizontal
- set(v):
- axis_stretch_horizontal = v
- emit_changed()
-@export
-var axis_stretch_vertical : RenderingServer.NinePatchAxisMode = RenderingServer.NINE_PATCH_STRETCH:
- get: return axis_stretch_vertical
- set(v):
- axis_stretch_vertical = v
- emit_changed()
-
-@export_group("Sub-Region", "region_")
-@export
-var region_rect : Rect2 = Rect2(0, 0, 0, 0):
- get: return region_rect
- set(v):
- region_rect = v
- emit_changed()
-
-@export_group("Modulate", "modulate_")
-@export
-var modulate_color : Color = Color(1, 1, 1, 1):
- get: return modulate_color
- set(v):
- modulate_color = v
- emit_changed()
-
-@export_group("Content Margins", "content_margin_")
-@export
-var content_margin_left : float = -1:
- get: return content_margin_left
- set(v):
- content_margin_left = v
- emit_changed()
-@export
-var content_margin_top : float = -1:
- get: return content_margin_top
- set(v):
- content_margin_top = v
- emit_changed()
-@export
-var content_margin_right : float = -1:
- get: return content_margin_right
- set(v):
- content_margin_right = v
- emit_changed()
-@export
-var content_margin_bottom : float = -1:
- get: return content_margin_bottom
- set(v):
- content_margin_bottom = v
- emit_changed()