aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/singletons/AssetManager.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-12-26 00:00:02 +0100
committer GitHub <noreply@github.com>2023-12-26 00:00:02 +0100
commitd114ecaa5a54f1e8e20828561a3cd26a09dc10a3 (patch)
treea59c5b960a706a383b8ebd1dbcfb704067a5b51b /extension/src/openvic-extension/singletons/AssetManager.cpp
parentd26c990d9a5596a3ef3b32ba1cb0f99950cd6d34 (diff)
parent4e9764ee29fb7b453862835d5aa3a081b0f9a269 (diff)
Merge pull request #179 from OpenVicProject/ui-work
GUIOverlappingElementsBox + GUINode improvements
Diffstat (limited to 'extension/src/openvic-extension/singletons/AssetManager.cpp')
-rw-r--r--extension/src/openvic-extension/singletons/AssetManager.cpp45
1 files changed, 0 insertions, 45 deletions
diff --git a/extension/src/openvic-extension/singletons/AssetManager.cpp b/extension/src/openvic-extension/singletons/AssetManager.cpp
index 8e9eb41..581c7fa 100644
--- a/extension/src/openvic-extension/singletons/AssetManager.cpp
+++ b/extension/src/openvic-extension/singletons/AssetManager.cpp
@@ -15,11 +15,6 @@ using OpenVic::Utilities::std_to_godot_string;
void AssetManager::_bind_methods() {
OV_BIND_METHOD(AssetManager::get_image, { "path" });
OV_BIND_METHOD(AssetManager::get_texture, { "path" });
-
- OV_BIND_SMETHOD(AssetManager::make_icon, { "texture", "frame", "frame_count" });
- OV_BIND_METHOD(AssetManager::get_icon, { "texture", "frame", "frame_count" });
-
- OV_BIND_METHOD(AssetManager::get_texture_or_icon, { "path", "frame", "frame_count" });
OV_BIND_METHOD(AssetManager::get_font, { "name" });
}
@@ -96,46 +91,6 @@ Ref<ImageTexture> AssetManager::get_texture(StringName path) {
}
}
-Ref<AtlasTexture> AssetManager::make_icon(Ref<Texture2D> texture, GFX::frame_t frame, GFX::frame_t frame_count) {
- ERR_FAIL_NULL_V(texture, nullptr);
-
- if (frame_count <= GFX::NO_FRAMES) {
- UtilityFunctions::push_warning("No frames!");
- frame_count = 1;
- }
- if (frame <= GFX::NO_FRAMES || frame > frame_count) {
- UtilityFunctions::push_warning("Invalid frame index ", frame, " out of count ", frame_count);
- frame = frame_count;
- }
- frame--;
- const Vector2i size = texture->get_size();
- const Rect2i region { frame * size.x / frame_count, 0, size.x / frame_count, size.y };
-
- Ref<AtlasTexture> atlas;
- atlas.instantiate();
- ERR_FAIL_NULL_V(atlas, nullptr);
- atlas->set_atlas(texture);
- atlas->set_region(region);
- return atlas;
-}
-
-Ref<AtlasTexture> AssetManager::get_icon(StringName path, GFX::frame_t frame, GFX::frame_t frame_count) {
- Ref<ImageTexture> texture = get_texture(path);
- ERR_FAIL_NULL_V(texture, nullptr);
- return make_icon(texture, frame, frame_count);
-}
-
-Ref<Texture2D> AssetManager::get_texture_or_icon(StringName path, GFX::frame_t frame, GFX::frame_t frame_count) {
- if (frame_count < 2) {
- if (frame > frame_count) {
- UtilityFunctions::push_warning("Invalid frame index ", frame, " out of count ", frame_count);
- }
- return get_texture(path);
- } else {
- return get_icon(path, frame, frame_count);
- }
-}
-
Ref<Font> AssetManager::get_font(StringName name) {
const font_map_t::const_iterator it = fonts.find(name);
if (it != fonts.end()) {