singletons
This commit is contained in:
@@ -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("\\/"));
|
||||
|
||||
Reference in New Issue
Block a user