From 4e9764ee29fb7b453862835d5aa3a081b0f9a269 Mon Sep 17 00:00:00 2001 From: hop311 Date: Mon, 18 Dec 2023 23:38:54 +0000 Subject: Back to UI Work - UIAdapter -> UITools with cleaner API - GUIOverlappingElementsBox (for core and modifier icons) - Improved GUINode API - Province building slots - TypeHints for files in the GameSession folder - Incorporate SIM strong colour types --- .../src/openvic-extension/utility/Utilities.hpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'extension/src/openvic-extension/utility/Utilities.hpp') diff --git a/extension/src/openvic-extension/utility/Utilities.hpp b/extension/src/openvic-extension/utility/Utilities.hpp index 6eeb285..9bbc700 100644 --- a/extension/src/openvic-extension/utility/Utilities.hpp +++ b/extension/src/openvic-extension/utility/Utilities.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include #include @@ -37,12 +37,8 @@ namespace OpenVic::Utilities { godot::String date_to_formatted_string(Date date); - inline godot::Color to_godot_color(colour_t colour) { - return { - colour_byte_to_float((colour >> 16) & 0xFF), - colour_byte_to_float((colour >> 8) & 0xFF), - colour_byte_to_float(colour & 0xFF) - }; + inline godot::Color to_godot_color(IsColour auto colour) { + return { colour.redf(), colour.greenf(), colour.bluef(), colour.alphaf() }; } inline godot::Vector2i to_godot_ivec2(ivec2_t vec) { @@ -63,4 +59,14 @@ namespace OpenVic::Utilities { /* Load a Font from anywhere on the machine, combining the ".fnt" file loaded from the given path with the * already-loaded image file containing the actual characters. */ godot::Ref load_godot_font(godot::String const& fnt_path, godot::Ref const& image); + + godot::Ref make_solid_colour_image( + godot::Color const& colour, int32_t width, int32_t height, + godot::Image::Format format = godot::Image::Format::FORMAT_RGBA8 + ); + + godot::Ref make_solid_colour_texture( + godot::Color const& colour, int32_t width, int32_t height, + godot::Image::Format format = godot::Image::Format::FORMAT_RGBA8 + ); } -- cgit v1.2.3-56-ga3b1