From 843edde55306e3fbdb5e37ef9b7c09c7b53f50c4 Mon Sep 17 00:00:00 2001 From: hop311 Date: Sat, 24 Feb 2024 13:17:07 +0000 Subject: Added GUIScrollbar and GFXCorneredTileSupportingTexture --- extension/src/openvic-extension/utility/UITools.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'extension/src/openvic-extension/utility/UITools.cpp') diff --git a/extension/src/openvic-extension/utility/UITools.cpp b/extension/src/openvic-extension/utility/UITools.cpp index a3e70b5..9cd5db0 100644 --- a/extension/src/openvic-extension/utility/UITools.cpp +++ b/extension/src/openvic-extension/utility/UITools.cpp @@ -16,6 +16,7 @@ #include "openvic-extension/classes/GFXMaskedFlagTexture.hpp" #include "openvic-extension/classes/GFXPieChartTexture.hpp" #include "openvic-extension/classes/GUIOverlappingElementsBox.hpp" +#include "openvic-extension/classes/GUIScrollbar.hpp" #include "openvic-extension/singletons/AssetManager.hpp" #include "openvic-extension/singletons/GameSingleton.hpp" #include "openvic-extension/utility/Utilities.hpp" @@ -133,6 +134,8 @@ static bool generate_icon(generate_gui_args_t&& args) { ret &= new_control(godot_texture_rect, icon, args.name); ERR_FAIL_NULL_V_MSG(godot_texture_rect, false, vformat("Failed to create TextureRect for GUI icon %s", icon_name)); + godot_texture_rect->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); + GFX::IconTextureSprite const* texture_sprite = icon.get_sprite()->cast_to(); Ref texture = GFXSpriteTexture::make_gfx_sprite_texture(texture_sprite, icon.get_frame()); if (texture.is_valid()) { @@ -461,6 +464,7 @@ static bool generate_overlapping_elements(generate_gui_args_t&& args) { box, false, vformat("Failed to create GUIOverlappingElementsBox for GUI overlapping elements %s", overlapping_elements_name) ); + box->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); ret &= box->set_gui_overlapping_elements_box(&overlapping_elements) == OK; args.result = box; return ret; @@ -503,7 +507,21 @@ static bool generate_texteditbox(generate_gui_args_t&& args) { } static bool generate_scrollbar(generate_gui_args_t&& args) { - return generate_placeholder(std::move(args), { 1.0f, 0.0f, 0.0f, 0.3f }); + GUI::Scrollbar const& scrollbar = static_cast(args.element); + + const String scrollbar_name = std_view_to_godot_string(scrollbar.get_name()); + + GUIScrollbar* gui_scrollbar = nullptr; + bool ret = new_control(gui_scrollbar, scrollbar, args.name); + ERR_FAIL_NULL_V_MSG(gui_scrollbar, false, vformat("Failed to create GUIScrollbar for GUI scrollbar %s", scrollbar_name)); + + if (gui_scrollbar->set_gui_scrollbar(&scrollbar) != OK) { + UtilityFunctions::push_error("Error initialising GUIScrollbar for GUI scrollbar ", scrollbar_name); + ret = false; + } + + args.result = gui_scrollbar; + return ret; } /* Forward declaration for use in generate_window. */ -- cgit v1.2.3-56-ga3b1