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,8 +7,6 @@
#include <unordered_map>
#include <vector>
class Asset;
class Input;
class Menu;
class Text;
class Texture;
@@ -19,7 +17,7 @@ struct JA_Sound_t;
// Singleton inicializado desde Director; las escenas consultan handles via get*().
class Resource {
public:
static void init(SDL_Renderer *renderer, Asset *asset, Input *input);
static void init(SDL_Renderer *renderer);
static void destroy();
static Resource *get();
@@ -32,14 +30,12 @@ class Resource {
const std::vector<uint8_t> &getDemoBytes() const { return demoBytes_; }
private:
Resource(SDL_Renderer *renderer, Asset *asset, Input *input);
Resource(SDL_Renderer *renderer);
~Resource();
void preloadAll();
SDL_Renderer *renderer_;
Asset *asset_;
Input *input_;
std::unordered_map<std::string, Texture *> textures_;
std::unordered_map<std::string, JA_Sound_t *> sounds_;