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 --- extension/src/openvic-extension/utility/Utilities.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'extension/src/openvic-extension/utility/Utilities.cpp') diff --git a/extension/src/openvic-extension/utility/Utilities.cpp b/extension/src/openvic-extension/utility/Utilities.cpp index 099b5a9..8293e70 100644 --- a/extension/src/openvic-extension/utility/Utilities.cpp +++ b/extension/src/openvic-extension/utility/Utilities.cpp @@ -122,3 +122,18 @@ Ref Utilities::load_godot_font(String const& fnt_path, Ref cons } return font; } + +Ref Utilities::make_solid_colour_image(Color const& colour, int32_t width, int32_t height, Image::Format format) { + const Ref result = Image::create(width, height, false, format); + ERR_FAIL_NULL_V(result, nullptr); + result->fill(colour); + return result; +} + +Ref Utilities::make_solid_colour_texture(Color const& colour, int32_t width, int32_t height, Image::Format format) { + const Ref image = make_solid_colour_image(colour, width, height, format); + ERR_FAIL_NULL_V(image, nullptr); + const Ref result = ImageTexture::create_from_image(image); + ERR_FAIL_NULL_V(result, nullptr); + return result; +} -- cgit v1.2.3-56-ga3b1