diff options
author | BrickPi <ajmach6@gmail.com> | 2024-11-14 04:05:46 +0100 |
---|---|---|
committer | BrickPi <ajmach6@gmail.com> | 2024-11-14 04:05:46 +0100 |
commit | 87ac0ca20d78c45507f03da78bce398e471e944f (patch) | |
tree | c797bc7d359e6f5788172c6e1b222d1fd9c7de33 /extension/src/openvic-extension/utility/UITools.cpp | |
parent | 7f7510cd3c3541b596d97eff8ade42e819d82c85 (diff) |
switch minimap background UI
Diffstat (limited to 'extension/src/openvic-extension/utility/UITools.cpp')
-rw-r--r-- | extension/src/openvic-extension/utility/UITools.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/extension/src/openvic-extension/utility/UITools.cpp b/extension/src/openvic-extension/utility/UITools.cpp index 4bd537d..0eea6c4 100644 --- a/extension/src/openvic-extension/utility/UITools.cpp +++ b/extension/src/openvic-extension/utility/UITools.cpp @@ -1,4 +1,5 @@ #include "UITools.hpp" +#include <cmath> #include <godot_cpp/classes/color_rect.hpp> #include <godot_cpp/classes/line_edit.hpp> @@ -22,6 +23,9 @@ #include "openvic-extension/singletons/AssetManager.hpp" #include "openvic-extension/singletons/GameSingleton.hpp" #include "openvic-extension/utility/Utilities.hpp" +#include "godot_cpp/classes/control.hpp" +#include "godot_cpp/variant/vector2.hpp" +#include "openvic-simulation/types/Vector.hpp" using namespace godot; using namespace OpenVic; @@ -482,14 +486,18 @@ static bool generate_window(generate_gui_args_t&& args) { GUI::Window const& window = static_cast<GUI::Window const&>(args.element); - // TODO - moveable, fullscreen, dontRender (disable visibility?) + // TODO - moveable, dontRender (disable visibility?) const String window_name = Utilities::std_to_godot_string(window.get_name()); Panel* godot_panel = nullptr; bool ret = new_control(godot_panel, window, args.name); ERR_FAIL_NULL_V_MSG(godot_panel, false, vformat("Failed to create Panel for GUI window %s", window_name)); - godot_panel->set_custom_minimum_size(Utilities::to_godot_fvec2(window.get_size())); + if (window.get_fullscreen()) { + godot_panel->set_anchors_preset(godot::Control::PRESET_FULL_RECT); + } else { + godot_panel->set_custom_minimum_size(Utilities::to_godot_fvec2(window.get_size())); + } Ref<StyleBoxEmpty> stylebox_empty; stylebox_empty.instantiate(); |