aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/classes/GFXIconTexture.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/classes/GFXIconTexture.cpp
parentd26c990d9a5596a3ef3b32ba1cb0f99950cd6d34 (diff)
parent4e9764ee29fb7b453862835d5aa3a081b0f9a269 (diff)
Merge pull request #179 from OpenVicProject/ui-work
GUIOverlappingElementsBox + GUINode improvements
Diffstat (limited to 'extension/src/openvic-extension/classes/GFXIconTexture.cpp')
-rw-r--r--extension/src/openvic-extension/classes/GFXIconTexture.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/extension/src/openvic-extension/classes/GFXIconTexture.cpp b/extension/src/openvic-extension/classes/GFXIconTexture.cpp
index 57c5d50..895bf6b 100644
--- a/extension/src/openvic-extension/classes/GFXIconTexture.cpp
+++ b/extension/src/openvic-extension/classes/GFXIconTexture.cpp
@@ -5,6 +5,7 @@
#include "openvic-extension/singletons/AssetManager.hpp"
#include "openvic-extension/singletons/GameSingleton.hpp"
#include "openvic-extension/utility/ClassBindings.hpp"
+#include "openvic-extension/utility/UITools.hpp"
#include "openvic-extension/utility/Utilities.hpp"
using namespace godot;
@@ -71,12 +72,8 @@ Error GFXIconTexture::set_gfx_texture_sprite_name(String const& gfx_texture_spri
if (gfx_texture_sprite_name.is_empty()) {
return set_gfx_texture_sprite(nullptr);
}
- GameSingleton* game_singleton = GameSingleton::get_singleton();
- ERR_FAIL_NULL_V(game_singleton, FAILED);
- GFX::Sprite const* sprite = game_singleton->get_game_manager().get_ui_manager().get_sprite_by_identifier(
- godot_to_std_string(gfx_texture_sprite_name)
- );
- ERR_FAIL_NULL_V_MSG(sprite, FAILED, vformat("GFX sprite not found: %s", gfx_texture_sprite_name));
+ GFX::Sprite const* sprite = UITools::get_gfx_sprite(gfx_texture_sprite_name);
+ ERR_FAIL_NULL_V(sprite, FAILED);
GFX::TextureSprite const* new_texture_sprite = sprite->cast_to<GFX::TextureSprite>();
ERR_FAIL_NULL_V_MSG(
new_texture_sprite, FAILED, vformat(