aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/utility/Utilities.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'extension/src/openvic-extension/utility/Utilities.hpp')
-rw-r--r--extension/src/openvic-extension/utility/Utilities.hpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/extension/src/openvic-extension/utility/Utilities.hpp b/extension/src/openvic-extension/utility/Utilities.hpp
index f7a0d67..15ff6b6 100644
--- a/extension/src/openvic-extension/utility/Utilities.hpp
+++ b/extension/src/openvic-extension/utility/Utilities.hpp
@@ -1,5 +1,7 @@
#pragma once
+#include <concepts>
+
#include <godot_cpp/classes/font_file.hpp>
#include <godot_cpp/classes/image_texture.hpp>
@@ -35,6 +37,10 @@ namespace OpenVic::Utilities {
godot::String float_to_formatted_string(float val, int32_t decimal_places);
+ constexpr real_t to_real_t(std::floating_point auto val) {
+ return static_cast<real_t>(val);
+ }
+
godot::String date_to_formatted_string(Date date);
_FORCE_INLINE_ godot::Color to_godot_color(IsColour auto colour) {
@@ -73,4 +79,8 @@ namespace OpenVic::Utilities {
godot::Color const& colour, int32_t width, int32_t height,
godot::Image::Format format = godot::Image::Format::FORMAT_RGBA8
);
-}
+
+ namespace literals {
+ constexpr real_t operator""_real(long double val) { return to_real_t(val); }
+ }
+} \ No newline at end of file