Replace dawnlibs with dawn.hpp

This commit is contained in:
2024-11-25 17:08:25 -06:00
parent cfa9e0e99a
commit aefbe17786
33 changed files with 86 additions and 59 deletions

View File

@ -6,7 +6,7 @@
*/
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
/**
* Asserts that a given statement must evaluate to true or the assertion fails

View File

@ -97,16 +97,16 @@ bool_t AssetDataLoader::isOpen() {
}
void AssetDataLoader::open() {
assertNull(this->assetArchiveFile, "AssetDataLoader::open: File is already open");
assertNull(this->assetArchive, "AssetDataLoader::open: Archive is already open");
assertNull(this->assetArchiveEntry, "AssetDataLoader::open: Entry is already open");
assertNull(this->assetArchiveFile, "File is already open");
assertNull(this->assetArchive, "Archive is already open");
assertNull(this->assetArchiveEntry, "Entry is already open");
this->assetArchiveFile = this->openAssetArchiveFile();
assertNotNull(this->assetArchiveFile, "AssetDataLoader::open: Failed to open archive file!");
assertNotNull(this->assetArchiveFile, "Failed to open archive file!");
// Open archive reader
assetArchive = archive_read_new();
assertNotNull(assetArchive, "AssetDataLoader::open: Failed to create archive reader");
assertNotNull(assetArchive, "Failed to create archive reader");
// Set up the reader
archive_read_support_format_tar(assetArchive);
@ -119,7 +119,7 @@ void AssetDataLoader::open() {
archive_read_set_callback_data(assetArchive, this);
int32_t ret = archive_read_open1(assetArchive);
assertTrue(ret == ARCHIVE_OK, "AssetDataLoader::open: Failed to open archive!");
assertTrue(ret == ARCHIVE_OK, "Failed to open archive!");
position = 0;
// Iterate over each file to find the one for this asset loader.
@ -127,20 +127,20 @@ void AssetDataLoader::open() {
const char_t *headerFile = (char_t*)archive_entry_pathname(assetArchiveEntry);
if(std::string(headerFile) == this->fileName) return;
int32_t ret = archive_read_data_skip(assetArchive);
assertTrue(ret == ARCHIVE_OK, "AssetDataLoader::open: Failed to skip data!");
assertTrue(ret == ARCHIVE_OK, "Failed to skip data!");
}
assertUnreachable("AssetDataLoader::open: Failed to find file!");
assertUnreachable("Failed to find file!");
}
int32_t AssetDataLoader::close() {
assertNotNull(this->assetArchiveFile, "AssetDataLoader::close: File is NULL");
assertNotNull(this->assetArchive, "AssetDataLoader::close: Archive is NULL!");
assertNotNull(this->assetArchiveEntry, "AssetDataLoader::close: Entry is NULL!");
assertNotNull(this->assetArchiveFile, "File is NULL");
assertNotNull(this->assetArchive, "Archive is NULL!");
assertNotNull(this->assetArchiveEntry, "Entry is NULL!");
// Close the archive
int32_t ret = archive_read_free(this->assetArchive);
assertTrue(ret == ARCHIVE_OK, "AssetDataLoader::close: Failed to close archive!");
assertTrue(ret == ARCHIVE_OK, "Failed to close archive!");
this->assetArchive = nullptr;
this->assetArchiveEntry = nullptr;

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
extern "C" {
#include <archive.h>

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
namespace Dawn {
class AssetLoader {

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
#include "asset/AssetLoader.hpp"
namespace Dawn {

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
namespace Dawn {
class IAudioManager {

View File

@ -0,0 +1,12 @@
// Copyright (c) 2024 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "Registry.hpp"
using namespace Dawn;
void Dawn::someFunction(const char_t *someParam) {
printf("Hello, %s!\n", someParam);
}

View File

@ -0,0 +1,11 @@
// Copyright (c) 2024 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "dawn.hpp"
namespace Dawn {
static void someFunction(const char_t *someParam);
}

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
namespace Dawn {
struct ColorU8 {

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
#include "display/RenderTarget.hpp"
#include "display/RenderPipeline.hpp"
#include "display/shader/ShaderManager.hpp"

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
namespace Dawn {
class Game;

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
namespace Dawn {
struct TrueTypeCharacter {

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
namespace Dawn {
enum MeshDrawMode {

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
namespace Dawn {
enum class ShaderParameterType {

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
namespace Dawn {
enum class ShaderStageType {

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
namespace Dawn {
class Environment {

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
namespace Dawn {
enum class CustomEventResult {

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
namespace Dawn {
template<typename ...A>

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
#include "display/RenderHost.hpp"
#include "input/InputManager.hpp"
#include "time/TimeManager.hpp"

View File

@ -25,6 +25,10 @@ std::string LocaleManager::getString(
const std::unordered_map<std::string, std::string> replacements
) {
assertNotNull(languageAsset, "Language asset cannot be null.");
assertTrue(
languageAsset->loaded,
"Language asset must be loaded before attempting to get a string."
);
// Key comes in like "main_menu.new_game", which would be;
// data["main_menu"]["new_game"], so we need to split by dot and iterate.

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
namespace Dawn {
class SaveManager;

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
#define SCENE_COMPONENT_STATE_INIT 0x01
#define SCENE_COMPONENT_STATE_DISPOSED 0x02

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
namespace Dawn {
class SceneItem;

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
namespace Dawn {
class ITimeManager {

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
namespace Dawn {
class Flag final {

View File

@ -6,7 +6,7 @@
*/
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
#define MATH_PI 3.1415926535897f

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "dawn.hpp"
namespace Dawn {
class String {