aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/interface/UI.cpp
diff options
context:
space:
mode:
author George L. Albany <Megacake1234@gmail.com>2023-12-24 23:00:36 +0100
committer GitHub <noreply@github.com>2023-12-24 23:00:36 +0100
commitbf4e7368600bb425b6612231fbb84de34ec99a27 (patch)
treed3b29714d3286b9edbe380f877bbce541344a635 /src/openvic-simulation/interface/UI.cpp
parentf036506b88af02508242f279ca29b743ef713976 (diff)
parent3770de7a03879a8ff6b8cf22b402217c19fa2b53 (diff)
Merge pull request #100 from OpenVicProject/change/colour_t_to_struct
Diffstat (limited to 'src/openvic-simulation/interface/UI.cpp')
-rw-r--r--src/openvic-simulation/interface/UI.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/openvic-simulation/interface/UI.cpp b/src/openvic-simulation/interface/UI.cpp
index 3fc8295..344fc15 100644
--- a/src/openvic-simulation/interface/UI.cpp
+++ b/src/openvic-simulation/interface/UI.cpp
@@ -1,17 +1,23 @@
#include "UI.hpp"
+#include "openvic-simulation/types/Colour.hpp"
+
using namespace OpenVic;
using namespace OpenVic::NodeTools;
using namespace OpenVic::GFX;
using namespace OpenVic::GUI;
-bool UIManager::add_font(std::string_view identifier, colour_t colour, std::string_view fontname) {
+bool UIManager::add_font(std::string_view identifier, colour_argb_t colour, std::string_view fontname) {
if (identifier.empty()) {
Logger::error("Invalid font identifier - empty!");
return false;
}
+ if (colour.alpha == colour_argb_t::colour_traits::null) {
+ Logger::error("Invalid colour for font ", identifier, " - completely transparent! (", colour, ")");
+ return false;
+ }
if (fontname.empty()) {
- Logger::error("Invalid culture colour for ", identifier, ": ", colour_to_hex_string(colour));
+ Logger::error("Invalid fontname for font ", identifier, " - empty!");
return false;
}
return fonts.add_item({ identifier, colour, fontname }, duplicate_warning_callback);
@@ -19,7 +25,7 @@ bool UIManager::add_font(std::string_view identifier, colour_t colour, std::stri
bool UIManager::_load_font(ast::NodeCPtr node) {
std::string_view identifier, fontname;
- colour_t colour = NULL_COLOUR;
+ colour_argb_t colour = colour_argb_t::null();
bool ret = expect_dictionary_keys(
"name", ONE_EXACTLY, expect_string(assign_variable_callback(identifier)),
"fontname", ONE_EXACTLY, expect_string(assign_variable_callback(fontname)),