aboutsummaryrefslogtreecommitdiff
path: root/extension/src/Utilities.cpp
blob: a91249075c69cd4568bb1209c87335bc9d3b122d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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);
   }
}