singletons

This commit is contained in:
2026-04-17 21:27:30 +02:00
parent 5889df2a47
commit 513eacf356
27 changed files with 536 additions and 505 deletions

View File

@@ -7,6 +7,23 @@
#include "core/resources/resource_helper.h"
// Instancia única
Asset *Asset::instance = nullptr;
// Singleton API
void Asset::init(const std::string &executablePath) {
Asset::instance = new Asset(executablePath);
}
void Asset::destroy() {
delete Asset::instance;
Asset::instance = nullptr;
}
auto Asset::get() -> Asset * {
return Asset::instance;
}
// Constructor
Asset::Asset(std::string executablePath) {
this->executablePath = executablePath.substr(0, executablePath.find_last_of("\\/"));