aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/singletons/GameSingleton.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-05-12 17:17:32 +0200
committer GitHub <noreply@github.com>2024-05-12 17:17:32 +0200
commitbfccdb87d66304604ad018037db1581746646bfa (patch)
treeac4394e8ceaca22fa0deaeebd8cf5eafedecaa3e /extension/src/openvic-extension/singletons/GameSingleton.cpp
parentb0a533f945bbc6201fd7df4bc60746cb98efaba4 (diff)
parentac29e4040fc20c50c8f0eb64b1194f6398165eb0 (diff)
Merge pull request #227 from OpenVicProject/models
Models
Diffstat (limited to 'extension/src/openvic-extension/singletons/GameSingleton.cpp')
-rw-r--r--extension/src/openvic-extension/singletons/GameSingleton.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/extension/src/openvic-extension/singletons/GameSingleton.cpp b/extension/src/openvic-extension/singletons/GameSingleton.cpp
index 838542d..ef19a6c 100644
--- a/extension/src/openvic-extension/singletons/GameSingleton.cpp
+++ b/extension/src/openvic-extension/singletons/GameSingleton.cpp
@@ -44,6 +44,7 @@ void GameSingleton::_bind_methods() {
OV_BIND_METHOD(GameSingleton::load_defines_compatibility_mode, { "file_paths" });
OV_BIND_SMETHOD(search_for_game_path, { "hint_path" }, DEFVAL(String {}));
+ OV_BIND_METHOD(GameSingleton::lookup_file_path, { "path" });
OV_BIND_METHOD(GameSingleton::setup_game, { "bookmark_index" });
@@ -158,6 +159,10 @@ float GameSingleton::get_map_aspect_ratio() const {
return static_cast<float>(get_map_width()) / static_cast<float>(get_map_height());
}
+Vector2 GameSingleton::map_position_to_world_coords(fvec2_t const& position) const {
+ return Utilities::to_godot_fvec2(position) / get_map_dims();
+}
+
Ref<Texture2DArray> GameSingleton::get_terrain_texture() const {
return terrain_texture;
}
@@ -593,3 +598,7 @@ Error GameSingleton::load_defines_compatibility_mode(PackedStringArray const& fi
String GameSingleton::search_for_game_path(String const& hint_path) {
return std_to_godot_string(Dataloader::search_for_game_path(godot_to_std_string(hint_path)).string());
}
+
+String GameSingleton::lookup_file_path(String const& path) const {
+ return std_to_godot_string(dataloader.lookup_file(godot_to_std_string(path)).string());
+}