aboutsummaryrefslogtreecommitdiff
path: root/extension/src/Utilities.cpp
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-05-25 01:17:53 +0200
committer Hop311 <hop3114@gmail.com>2023-05-25 01:17:53 +0200
commitb493547fb8c77918306fe56b74b704284cf54931 (patch)
tree6525f869dccdbeb61ed82d6a42afeb625680a885 /extension/src/Utilities.cpp
parent0a1a50cde54fee469bc0069978cd27a2bd1a2fb0 (diff)
Import fix + ProvinceOverviewPanel close fix
Diffstat (limited to 'extension/src/Utilities.cpp')
-rw-r--r--extension/src/Utilities.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/extension/src/Utilities.cpp b/extension/src/Utilities.cpp
new file mode 100644
index 0000000..a912490
--- /dev/null
+++ b/extension/src/Utilities.cpp
@@ -0,0 +1,16 @@
+#include "Utilities.hpp"
+
+#include <godot_cpp/classes/resource_loader.hpp>
+#include <godot_cpp/variant/utility_functions.hpp>
+
+using namespace godot;
+using namespace OpenVic;
+
+Ref<Image> OpenVic::load_godot_image(String const& path) {
+ if (path.begins_with("res://")) {
+ ResourceLoader* loader = ResourceLoader::get_singleton();
+ return loader ? loader->load(path) : nullptr;
+ } else {
+ return Image::load_from_file(path);
+ }
+}