aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/Utilities.hpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-11-08 22:23:39 +0100
committer GitHub <noreply@github.com>2023-11-08 22:23:39 +0100
commitf8da0860795d273452501fa4d7fbfcc40073a884 (patch)
tree556707348d57b81f91627bb8fda5989a305c0d21 /extension/src/openvic-extension/Utilities.hpp
parent57822949341b86649614b343afa2c740efe00ac2 (diff)
parent47fff276966d42cba6a2df9093348a5e20a37159 (diff)
Merge pull request #162 from OpenVicProject/changes
Lots of Changes
Diffstat (limited to 'extension/src/openvic-extension/Utilities.hpp')
-rw-r--r--extension/src/openvic-extension/Utilities.hpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/extension/src/openvic-extension/Utilities.hpp b/extension/src/openvic-extension/Utilities.hpp
index 32e7cb5..f789f84 100644
--- a/extension/src/openvic-extension/Utilities.hpp
+++ b/extension/src/openvic-extension/Utilities.hpp
@@ -3,10 +3,11 @@
#include <godot_cpp/classes/image.hpp>
#include <openvic-simulation/types/Colour.hpp>
+#include <openvic-simulation/types/Vector.hpp>
#define ERR(x) ((x) ? OK : FAILED)
-namespace OpenVic {
+namespace OpenVic::Utilities {
inline std::string godot_to_std_string(godot::String const& str) {
return str.ascii().get_data();
@@ -16,15 +17,28 @@ namespace OpenVic {
return str.c_str();
}
+ inline godot::String std_view_to_godot_string(std::string_view str) {
+ return std_to_godot_string(static_cast<std::string>(str));
+ }
+
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) };
+ return {
+ colour_byte_to_float((colour >> 16) & 0xFF),
+ colour_byte_to_float((colour >> 8) & 0xFF),
+ colour_byte_to_float(colour & 0xFF)
+ };
+ }
+
+ inline godot::Vector2i to_godot_ivec2(ivec2_t vec) {
+ return { vec.x, vec.y };
}
godot::Ref<godot::Image> load_godot_image(godot::String const& path);
- void draw_pie_chart(godot::Ref<godot::Image> image,
- godot::Array const& stopAngles, godot::Array const& colours, float radius,
+ void draw_pie_chart(
+ godot::Ref<godot::Image> image, godot::Array const& stopAngles, godot::Array const& colours, float radius,
godot::Vector2 shadow_displacement, float shadow_tightness, float shadow_radius, float shadow_thickness,
- godot::Color trim_colour, float trim_size, float gradient_falloff, float gradient_base,
- bool donut, bool donut_inner_trim, float donut_inner_radius);
+ godot::Color trim_colour, float trim_size, float gradient_falloff, float gradient_base, bool donut,
+ bool donut_inner_trim, float donut_inner_radius
+ );
}