-
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.
Restore support for Godot 3 scene format
- Loading branch information
1 parent
0ccc4c1
commit a77dc7a
Showing
52 changed files
with
2,543 additions
and
161 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
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
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
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
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
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,16 @@ | ||
// Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0) | ||
|
||
#pragma once | ||
|
||
#include <expected> // expected | ||
|
||
#include "tactile/base/debug/error_code.hpp" | ||
|
||
namespace tactile { | ||
|
||
template <typename T> | ||
using Result = std::expected<T, ErrorCode>; | ||
|
||
inline constexpr Result<void> kOK {}; | ||
|
||
} // namespace tactile |
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,88 @@ | ||
// Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0) | ||
|
||
#pragma once | ||
|
||
#include <string_view> // string_view | ||
|
||
namespace tactile { | ||
|
||
/** | ||
* Provides common error codes. | ||
*/ | ||
enum class ErrorCode : int | ||
{ | ||
/** An unknown error occurred. */ | ||
kUnknown, | ||
|
||
/** An operation or feature isn't supported. */ | ||
kNotSupported, | ||
|
||
/** Not enough memory. */ | ||
kOutOfMemory, | ||
|
||
/** A stack overflow was detected. */ | ||
kStackOverflow, | ||
|
||
/** A stack underflow was detected. */ | ||
kStackUnderflow, | ||
|
||
/** Initialization failed. */ | ||
kBadInit, | ||
|
||
/** A given parameter is invalid. */ | ||
kBadParam, | ||
|
||
/** An invalid state was detected. */ | ||
kBadState, | ||
|
||
/** An invalid operation was attempted. */ | ||
kBadOperation, | ||
|
||
/** A file doesn't exist. */ | ||
kNoSuchFile, | ||
|
||
/** A file stream couldn't be created. */ | ||
kBadFileStream, | ||
|
||
/** A file couldn't be copied. */ | ||
kBadFileCopy, | ||
|
||
/** An invalid image was detected. */ | ||
kBadImage, | ||
|
||
/** An invalid save file was detected. */ | ||
kBadSaveFile, | ||
|
||
/** A compression operation failed. */ | ||
kCouldNotCompress, | ||
|
||
/** A decompression operation failed. */ | ||
kCouldNotDecompress, | ||
}; | ||
|
||
[[nodiscard]] | ||
constexpr auto to_string(const ErrorCode errc) noexcept -> std::string_view | ||
{ | ||
switch (errc) { | ||
case ErrorCode::kUnknown: return "unknown"; | ||
case ErrorCode::kNotSupported: return "not supported"; | ||
case ErrorCode::kOutOfMemory: return "out of memory"; | ||
case ErrorCode::kStackOverflow: return "stack overflow"; | ||
case ErrorCode::kStackUnderflow: return "stack underflow"; | ||
case ErrorCode::kBadInit: return "initialization error"; | ||
case ErrorCode::kBadParam: return "invalid parameter"; | ||
case ErrorCode::kBadState: return "invalid state"; | ||
case ErrorCode::kBadOperation: return "invalid operation"; | ||
case ErrorCode::kNoSuchFile: return "no such file"; | ||
case ErrorCode::kBadFileStream: return "file stream error"; | ||
case ErrorCode::kBadFileCopy: return "file copy error"; | ||
case ErrorCode::kBadImage: return "invalid image"; | ||
case ErrorCode::kBadSaveFile: return "invalid save file"; | ||
case ErrorCode::kCouldNotCompress: return "could not compress"; | ||
case ErrorCode::kCouldNotDecompress: return "could not decompress"; | ||
} | ||
|
||
return "?"; | ||
} | ||
|
||
} // namespace tactile |
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
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
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,21 @@ | ||
// Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0) | ||
|
||
#pragma once | ||
|
||
#include <cstddef> // size_t, ptrdiff_t | ||
|
||
namespace tactile { | ||
|
||
[[nodiscard]] | ||
consteval auto operator""_uz(const unsigned long long int value) noexcept -> std::size_t | ||
{ | ||
return static_cast<std::size_t>(value); | ||
} | ||
|
||
[[nodiscard]] | ||
consteval auto operator""_z(const unsigned long long int value) noexcept -> std::ptrdiff_t | ||
{ | ||
return static_cast<std::ptrdiff_t>(value); | ||
} | ||
|
||
} // namespace tactile |
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
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
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
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
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
Oops, something went wrong.