Bit of cleanup.
This commit is contained in:
@ -16,7 +16,11 @@ void AssetManager::update() {
|
||||
}
|
||||
|
||||
void AssetManager::queueLoad(std::vector<Asset*> assets) {
|
||||
vectorAppend(&this->assetsToLoad, &assets);
|
||||
std::merge(
|
||||
this->assetsToLoad.begin(), this->assetsToLoad.end(),
|
||||
assets.begin(), assets.end(),
|
||||
this->assetsToLoad.begin()
|
||||
);
|
||||
}
|
||||
|
||||
void AssetManager::queueLoad(Asset *asset) {
|
||||
@ -24,12 +28,20 @@ void AssetManager::queueLoad(Asset *asset) {
|
||||
}
|
||||
|
||||
void AssetManager::queueUnload(std::vector<Asset*> assets) {
|
||||
std::cout << "Asset list was queued to unload, but is not yet implemented" << std::endl;
|
||||
vectorAppend(&this->assetsToUnload, &assets);
|
||||
std::cout <<
|
||||
"Asset list was queued to unload, but is not yet implemented" <<
|
||||
std::endl;
|
||||
std::merge(
|
||||
this->assetsToUnload.begin(), this->assetsToUnload.end(),
|
||||
assets.begin(), assets.end(),
|
||||
this->assetsToUnload.begin()
|
||||
);
|
||||
}
|
||||
|
||||
void AssetManager::queueUnload(Asset *asset) {
|
||||
std::cout << "Asset was queued to unload, but is not yet implemented" << std::endl;
|
||||
std::cout <<
|
||||
"Asset was queued to unload, but is not yet implemented" <<
|
||||
std::endl;
|
||||
this->assetsToUnload.push_back(asset);
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
#pragma once
|
||||
#include "Asset.hpp"
|
||||
#include "util/array.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class AssetManager {
|
||||
@ -73,7 +72,9 @@ namespace Dawn {
|
||||
*/
|
||||
template<class T>
|
||||
T * get(std::string name) {
|
||||
assertTrue(name.size() > 0, "AssetManager::get: name must be greater than 0");
|
||||
assertTrue(
|
||||
name.size() > 0, "AssetManager::get: name must be greater than 0"
|
||||
);
|
||||
|
||||
auto existing = this->assets.find(name);
|
||||
if(existing != this->assets.end()) {
|
||||
|
@ -8,12 +8,18 @@
|
||||
using namespace Dawn;
|
||||
|
||||
IAssetLoader::IAssetLoader(std::string fileName) {
|
||||
assertTrue(fileName.size() > 0, "IAssetLoader::IAssetLoader: fileName must be greater than 0");
|
||||
assertTrue(
|
||||
fileName.size() > 0,
|
||||
"IAssetLoader::IAssetLoader: fileName must be greater than 0"
|
||||
);
|
||||
this->fileName = fileName;
|
||||
}
|
||||
|
||||
size_t IAssetLoader::setPosition(size_t position) {
|
||||
assertTrue(position >= 0, "IAssetLoader::setPosition: position must be greater than or equal to 0");
|
||||
assertTrue(
|
||||
position >= 0,
|
||||
"IAssetLoader::setPosition: position must be greater than or equal to 0"
|
||||
);
|
||||
this->rewind();
|
||||
return this->skip(position);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "TextureAsset.hpp"
|
||||
#include "util/memory.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
|
@ -24,24 +24,24 @@ TrueTypeAsset::TrueTypeAsset(AssetManager *assMan, std::string name) :
|
||||
lbt.erase(it0);
|
||||
|
||||
auto it1 = this->textureByLock.find(id);
|
||||
assertTrue(it1 != this->textureByLock.end(), "Could not remove textureByLock");
|
||||
assertTrue(
|
||||
it1 != this->textureByLock.end(), "Could not remove textureByLock"
|
||||
);
|
||||
this->textureByLock.erase(it1);
|
||||
|
||||
if(lbt.empty()) {
|
||||
auto it2 = locksByTexture.find(texture);
|
||||
assertTrue(it2 != locksByTexture.end(), "Could not remove locksByTexture");
|
||||
assertTrue(
|
||||
it2 != locksByTexture.end(), "Could not remove locksByTexture"
|
||||
);
|
||||
locksByTexture.erase(it2);
|
||||
|
||||
auto it3 = textureByStyle.begin();
|
||||
while(it3 != textureByStyle.end()) {
|
||||
if(it3->second == texture) it3 = textureByStyle.erase(it3);
|
||||
++it3;
|
||||
}
|
||||
|
||||
auto it4 = std::find(textures.begin(), textures.end(), texture);
|
||||
assertTrue(it4 != textures.end(), "Could not remove textureByStyle");
|
||||
textures.erase(it4);
|
||||
std::erase_if(textureByStyle, [&](const auto &item){
|
||||
auto const& [key, value] = item;
|
||||
return value == texture;
|
||||
});
|
||||
|
||||
std::erase(textures, texture);
|
||||
delete texture;
|
||||
}
|
||||
};
|
||||
|
@ -38,7 +38,9 @@ namespace Dawn {
|
||||
std::vector<struct TrueTypeAssetStyle> assetStyles;
|
||||
std::vector<TrueTypeFaceTexture*> textures;
|
||||
std::map<usagelockid_t, TrueTypeFaceTexture*> textureByLock;
|
||||
std::map<struct TrueTypeFaceTextureStyle, TrueTypeFaceTexture*> textureByStyle;
|
||||
std::map<struct TrueTypeFaceTextureStyle, TrueTypeFaceTexture*>
|
||||
textureByStyle
|
||||
;
|
||||
std::map<TrueTypeFaceTexture*, std::vector<usagelockid_t>> locksByTexture;
|
||||
|
||||
public:
|
||||
|
@ -4,7 +4,7 @@
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "display/_RenderManager.hpp"
|
||||
#include "display/IRenderManager.hpp"
|
||||
#include "display/shader/ShaderPass.hpp"
|
||||
#include "scene/components/display/IRenderable.hpp"
|
||||
#include "display/shader/buffers/RenderPipelineShaderBuffer.hpp"
|
||||
|
@ -4,6 +4,7 @@
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "TrueTypeFaceTexture.hpp"
|
||||
#include "util/memory.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "display/mesh/Mesh.hpp"
|
||||
#include "display/_RenderManager.hpp"
|
||||
#include "display/IRenderManager.hpp"
|
||||
#include "display/Texture.hpp"
|
||||
#include "display/shader/ShaderParameterBuffer.hpp"
|
||||
|
||||
@ -82,6 +82,5 @@ namespace Dawn {
|
||||
* @param Float to bind.
|
||||
*/
|
||||
virtual void setFloat(T parameter, float_t value) = 0;
|
||||
|
||||
};
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "SaveManager.hpp"
|
||||
#include "game/DawnGame.hpp"
|
||||
#include "util/memory.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
|
@ -9,4 +9,8 @@
|
||||
using namespace Dawn;
|
||||
|
||||
Material::Material(SceneItem *item) : SceneItemComponent(item) {
|
||||
}
|
||||
|
||||
ShaderManager & Material::getShaderManager() {
|
||||
return *this->getGame()->renderManager.getShaderManager();
|
||||
}
|
@ -17,5 +17,11 @@ namespace Dawn {
|
||||
* @param item Scene Item this component belongs to.
|
||||
*/
|
||||
Material(SceneItem *item);
|
||||
|
||||
/**
|
||||
* Returns the shader manager for the game.
|
||||
* @return The shader manager for the game.
|
||||
*/
|
||||
ShaderManager & getShaderManager();
|
||||
};
|
||||
}
|
@ -45,6 +45,7 @@ bool_t TriggerController2D::getCollidingResult(Collider2D* movingObject) {
|
||||
|
||||
default: {
|
||||
assertUnreachable("TriggerController2D::getCollidingResult: Moving object type not implemented");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user