-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b3b092
commit cb18c8d
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
source/godot_tscn_format/lib/inc/tactile/godot_tscn_format/godot_scene_format.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0) | ||
|
||
#pragma once | ||
|
||
#include "tactile/base/io/save/save_format.hpp" | ||
#include "tactile/base/runtime.hpp" | ||
#include "tactile/godot_tscn_format/api.hpp" | ||
|
||
namespace tactile::godot { | ||
|
||
/** | ||
* Provides support for the scene format used by the Godot game engine. | ||
* | ||
* \see https://docs.godotengine.org/en/stable/contributing/development/file_formats/tscn.html | ||
* \see https://docs.godotengine.org/en/3.6/development/file_formats/tscn.html | ||
*/ | ||
class TACTILE_GODOT_API GodotSceneFormat final : public ISaveFormat | ||
{ | ||
public: | ||
explicit GodotSceneFormat(IRuntime* runtime); | ||
|
||
[[nodiscard]] | ||
auto load_map(const std::filesystem::path& map_path, | ||
const SaveFormatReadOptions& options) const | ||
-> std::expected<ir::Map, std::error_code> override; | ||
|
||
[[nodiscard]] | ||
auto save_map(const IMapView& map, const SaveFormatWriteOptions& options) const | ||
-> std::expected<void, std::error_code> override; | ||
|
||
private: | ||
IRuntime* m_runtime; | ||
}; | ||
|
||
} // namespace tactile::godot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0) | ||
|
||
#include "tactile/godot_tscn_format/godot_scene_format.hpp" | ||
|
||
#include <system_error> // make_error_code, errc | ||
|
||
namespace tactile::godot { | ||
|
||
GodotSceneFormat::GodotSceneFormat(IRuntime* runtime) | ||
: m_runtime {runtime} | ||
{} | ||
|
||
auto GodotSceneFormat::load_map(const std::filesystem::path& map_path, | ||
const SaveFormatReadOptions& options) const | ||
-> std::expected<ir::Map, std::error_code> | ||
{ | ||
return std::unexpected {std::make_error_code(std::errc::not_supported)}; | ||
} | ||
|
||
auto GodotSceneFormat::save_map(const IMapView& map, | ||
const SaveFormatWriteOptions& options) const | ||
-> std::expected<void, std::error_code> | ||
{ | ||
return std::unexpected {std::make_error_code(std::errc::not_supported)}; | ||
} | ||
|
||
} // namespace tactile::godot |