diff options
author | Hop311 <Hop3114@gmail.com> | 2024-08-30 23:29:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-30 23:29:57 +0200 |
commit | f54e454afb90f8868e7c62529e2a388fdaadf20b (patch) | |
tree | f19dbcdfe613397e86dc52cc34e0a443bd0f3e96 /extension/src/openvic-extension/classes/GUINode.hpp | |
parent | 855e5b087459da19caf230cf22d99462680b268e (diff) | |
parent | d7672f406406eea46625bc725690651f28211e19 (diff) |
Merge pull request #251 from OpenVicProject/gui-text-label
Add GUILabel (colour code + currency icon support)
Diffstat (limited to 'extension/src/openvic-extension/classes/GUINode.hpp')
-rw-r--r-- | extension/src/openvic-extension/classes/GUINode.hpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/extension/src/openvic-extension/classes/GUINode.hpp b/extension/src/openvic-extension/classes/GUINode.hpp index f8eb62c..73ca92b 100644 --- a/extension/src/openvic-extension/classes/GUINode.hpp +++ b/extension/src/openvic-extension/classes/GUINode.hpp @@ -5,7 +5,6 @@ #include <godot_cpp/classes/control.hpp> #include <godot_cpp/classes/image.hpp> #include <godot_cpp/classes/input_event.hpp> -#include <godot_cpp/classes/label.hpp> #include <godot_cpp/classes/line_edit.hpp> #include <godot_cpp/classes/node.hpp> #include <godot_cpp/classes/panel.hpp> @@ -22,6 +21,7 @@ #include "openvic-extension/classes/GFXMaskedFlagTexture.hpp" #include "openvic-extension/classes/GFXPieChartTexture.hpp" #include "openvic-extension/classes/GFXSpriteTexture.hpp" +#include "openvic-extension/classes/GUILabel.hpp" #include "openvic-extension/classes/GUIListBox.hpp" #include "openvic-extension/classes/GUIOverlappingElementsBox.hpp" #include "openvic-extension/classes/GUIScrollbar.hpp" @@ -52,7 +52,7 @@ namespace OpenVic { static godot::Vector2 get_gui_position(godot::String const& gui_scene, godot::String const& gui_position); static godot::Button* get_button_from_node(godot::Node* node); - static godot::Label* get_label_from_node(godot::Node* node); + static GUILabel* get_gui_label_from_node(godot::Node* node); static godot::Panel* get_panel_from_node(godot::Node* node); static godot::TextureProgressBar* get_progress_bar_from_node(godot::Node* node); static godot::TextureRect* get_texture_rect_from_node(godot::Node* node); @@ -62,7 +62,7 @@ namespace OpenVic { static godot::LineEdit* get_line_edit_from_node(godot::Node* node); godot::Button* get_button_from_nodepath(godot::NodePath const& path) const; - godot::Label* get_label_from_nodepath(godot::NodePath const& path) const; + GUILabel* get_gui_label_from_nodepath(godot::NodePath const& path) const; godot::Panel* get_panel_from_nodepath(godot::NodePath const& path) const; godot::TextureProgressBar* get_progress_bar_from_nodepath(godot::NodePath const& path) const; godot::TextureRect* get_texture_rect_from_nodepath(godot::NodePath const& path) const; @@ -91,6 +91,8 @@ namespace OpenVic { static godot::String int_to_string_suffixed(int64_t val); static godot::String float_to_string_suffixed(float val); static godot::String float_to_string_dp(float val, int32_t decimal_places); + // 3dp if abs(val) < 2 else 2dp if abs(val) < 10 else 1dp + static godot::String float_to_string_dp_dynamic(float val); static godot::String format_province_name(godot::String const& province_identifier); godot::Ref<godot::BitMap> get_click_mask() const; |