Scopify assets

This commit is contained in:
2024-12-02 08:46:21 -06:00
parent 4dccd7d969
commit ac0f0e86c5
13 changed files with 78 additions and 46 deletions

View File

@@ -7,6 +7,8 @@
using namespace Dawn;
const std::string JSONLoader::ASSET_TYPE = "json";
JSONLoader::JSONLoader(
const std::shared_ptr<AssetManager> assetManager,
const std::string name
@@ -30,6 +32,10 @@ void JSONLoader::updateAsync() {
void JSONLoader::updateSync() {
}
std::string JSONLoader::getAssetType() const {
return JSONLoader::ASSET_TYPE;
}
JSONLoader::~JSONLoader() {
}

View File

@@ -23,6 +23,8 @@ namespace Dawn {
enum JSONLoaderState state;
public:
const static std::string ASSET_TYPE;
json data;
JSONLoader(
@@ -31,6 +33,7 @@ namespace Dawn {
);
void updateSync() override;
void updateAsync() override;
std::string getAssetType() const override;
~JSONLoader();
};
}

View File

@@ -7,6 +7,8 @@
using namespace Dawn;
const std::string SceneLoader::ASSET_TYPE = "scene";
SceneLoader::SceneLoader(
const std::shared_ptr<AssetManager> assetManager,
const std::string name
@@ -35,6 +37,10 @@ void SceneLoader::updateSync() {
}
std::string SceneLoader::getAssetType() const {
return SceneLoader::ASSET_TYPE;
}
std::shared_ptr<Scene> SceneLoader::getScene() {
return scene;
}

View File

@@ -21,12 +21,15 @@ namespace Dawn {
std::shared_ptr<Scene> scene;
public:
const static std::string ASSET_TYPE;
SceneLoader(
const std::shared_ptr<AssetManager> assetManager,
const std::string name
);
void updateSync() override;
void updateAsync() override;
std::string getAssetType() const override;
/**
* Returns the Scene that was loaded, or nullptr if not loaded.

View File

@@ -8,6 +8,8 @@
using namespace Dawn;
const std::string TextureLoader::ASSET_TYPE = "texture";
TextureLoader::TextureLoader(
const std::shared_ptr<AssetManager> assetManager,
const std::string name
@@ -137,6 +139,10 @@ void TextureLoader::updateSync() {
this->loaded = true;
}
std::string TextureLoader::getAssetType() const {
return TextureLoader::ASSET_TYPE;
}
std::shared_ptr<Texture> TextureLoader::getTexture() {
return this->texture;
}

View File

@@ -33,6 +33,8 @@ namespace Dawn {
std::shared_ptr<Texture> texture;
public:
const static std::string ASSET_TYPE;
TextureLoader(
const std::shared_ptr<AssetManager> assetManager,
const std::string name
@@ -40,6 +42,7 @@ namespace Dawn {
void updateSync() override;
void updateAsync() override;
std::string getAssetType() const override;
/**
* Get the texture asset.

View File

@@ -8,6 +8,8 @@
using namespace Dawn;
const std::string TrueTypeLoader::ASSET_TYPE = "ttf";
TrueTypeLoader::TrueTypeLoader(
const std::shared_ptr<AssetManager> assetManager,
const std::string name
@@ -65,6 +67,10 @@ void TrueTypeLoader::updateAsync() {
state = TrueTypeLoaderState::ASYNC_DONE;
}
std::string TrueTypeLoader::getAssetType() const {
return TrueTypeLoader::ASSET_TYPE;
}
std::shared_ptr<TrueTypeTexture> TrueTypeLoader::getTexture(
const uint32_t fontSize
) {

View File

@@ -27,6 +27,8 @@ namespace Dawn {
uint8_t *buffer = nullptr;
public:
const static std::string ASSET_TYPE;
TrueTypeLoader(
const std::shared_ptr<AssetManager> assetManager,
const std::string name
@@ -34,6 +36,7 @@ namespace Dawn {
void updateSync() override;
void updateAsync() override;
std::string getAssetType() const override;
/**
* Returns the texture for the given font size.