diff options
author | Hop311 <Hop3114@gmail.com> | 2024-07-26 21:13:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-26 21:13:00 +0200 |
commit | 7dfb935447708cfdff664603eadafcbb4aa24042 (patch) | |
tree | 72262f7d0d16ce06ad3deef026f3506ab6d8add7 /extension/src/openvic-extension/classes | |
parent | d4b223b491ec2d9b32393c4c58ad85f18bd9566e (diff) | |
parent | 35ccace5c13b547025a6b823442f7abed676a19f (diff) |
Merge pull request #242 from OpenVicProject/fix-checkbox
Fix checkbox theme and positioning
Diffstat (limited to 'extension/src/openvic-extension/classes')
4 files changed, 7 insertions, 4 deletions
diff --git a/extension/src/openvic-extension/classes/GFXSpriteTexture.cpp b/extension/src/openvic-extension/classes/GFXSpriteTexture.cpp index 41bea4b..b81f32e 100644 --- a/extension/src/openvic-extension/classes/GFXSpriteTexture.cpp +++ b/extension/src/openvic-extension/classes/GFXSpriteTexture.cpp @@ -21,6 +21,7 @@ void GFXSpriteTexture::_bind_methods() { OV_BIND_METHOD(GFXSpriteTexture::get_gfx_texture_sprite_name); OV_BIND_METHOD(GFXSpriteTexture::set_icon_index, { "new_icon_index" }); + OV_BIND_METHOD(GFXSpriteTexture::set_toggled_icon, { "toggle" }); OV_BIND_METHOD(GFXSpriteTexture::get_icon_index); OV_BIND_METHOD(GFXSpriteTexture::get_icon_count); @@ -133,3 +134,7 @@ Error GFXSpriteTexture::set_icon_index(int32_t new_icon_index) { _update_button_states(); return OK; } + +Error GFXSpriteTexture::set_toggled_icon(bool toggled) { + return set_icon_index(toggled ? 2 : 1); +} diff --git a/extension/src/openvic-extension/classes/GFXSpriteTexture.hpp b/extension/src/openvic-extension/classes/GFXSpriteTexture.hpp index 4e93e62..7b6b433 100644 --- a/extension/src/openvic-extension/classes/GFXSpriteTexture.hpp +++ b/extension/src/openvic-extension/classes/GFXSpriteTexture.hpp @@ -53,5 +53,7 @@ namespace OpenVic { * If zero is used but icon_count is non-zero, icon_index defaults to icon_count (the last frame, * not the first frame because it is often empty). */ godot::Error set_icon_index(GFX::frame_t new_icon_index); + + godot::Error set_toggled_icon(bool toggled); }; } diff --git a/extension/src/openvic-extension/classes/GUINode.cpp b/extension/src/openvic-extension/classes/GUINode.cpp index 452efc8..674f162 100644 --- a/extension/src/openvic-extension/classes/GUINode.cpp +++ b/extension/src/openvic-extension/classes/GUINode.cpp @@ -40,7 +40,6 @@ using namespace OpenVic; #define APPLY_TO_CHILD_TYPES(F) \ F(Button, button) \ - F(CheckBox, check_box) \ F(Label, label) \ F(Panel, panel) \ F(TextureProgressBar, progress_bar) \ diff --git a/extension/src/openvic-extension/classes/GUINode.hpp b/extension/src/openvic-extension/classes/GUINode.hpp index 60c0050..af1562e 100644 --- a/extension/src/openvic-extension/classes/GUINode.hpp +++ b/extension/src/openvic-extension/classes/GUINode.hpp @@ -2,7 +2,6 @@ #include <godot_cpp/classes/bit_map.hpp> #include <godot_cpp/classes/button.hpp> -#include <godot_cpp/classes/check_box.hpp> #include <godot_cpp/classes/control.hpp> #include <godot_cpp/classes/image.hpp> #include <godot_cpp/classes/input_event.hpp> @@ -52,7 +51,6 @@ 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::CheckBox* get_check_box_from_node(godot::Node* node); static godot::Label* get_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); @@ -62,7 +60,6 @@ namespace OpenVic { static GUIListBox* get_gui_listbox_from_node(godot::Node* node); godot::Button* get_button_from_nodepath(godot::NodePath const& path) const; - godot::CheckBox* get_check_box_from_nodepath(godot::NodePath const& path) const; godot::Label* get_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; |