Argentum Online - Cliente
|
|
1 #ifndef __RESOURCE_MANAGER_H
2 #define __RESOURCE_MANAGER_H
3 #include <unordered_map>
5 #include "SDL/sdl_animated_sprite.h"
6 #include "SDL/sdl_music.h"
7 #include "SDL/sdl_sfx.h"
8 #include "SDL/sdl_texture.h"
9 #include "SDL/sdl_texture_loader.h"
10 #include "SDL/sdl_bitmap_font.h"
11 #include "SDL2/SDL_ttf.h"
12 #include "animation_pack.h"
15 typedef std::unordered_map<std::string, std::unordered_map<int, SDLTexture>>
18 typedef std::unordered_map<std::string, std::unordered_map<int, AnimationPack>>
21 typedef std::unordered_map<std::string, std::unordered_map<int, SDLSprite>>
24 typedef std::unordered_map<int, TTF_Font*> FontMap;
26 typedef std::unordered_map<int, SDLMusic> MusicMap;
28 typedef std::unordered_map<int, SDLSoundFx> SoundFxMap;
30 typedef std::unordered_map<int, SDLBitmapFont> BitmapFontMap;
37 TextureMap texture_map;
38 AnimationPackMap animation_pack_map;
41 BitmapFontMap bitmap_font_map;
43 SoundFxMap sound_fx_map;
54 const std::string& texture_index_file);
62 void _load_animations(
const std::string& sprite_index_file);
70 void _load_fonts(
const std::string& font_index_file);
78 void _load_audio(
const std::string& audio_index_file);
AnimationPack & get_animation_pack(const std::string &type, int id)
Devuelve un pack de animacion.
Definition: resource_manager.cpp:193
Fuente bitmap.
Definition: sdl_bitmap_font.h:9
void free_resources()
Libera recursos alocados por el manager.
Definition: resource_manager.cpp:232
Wrapper de sprites de un mismo conjunto.
Definition: animation_pack.h:17
Objeto de efecto de sonido de SDL.
Definition: sdl_sfx.h:13
void init(SDLTextureLoader &loader)
Realiza la carga a memoria de todos los assets. Solo debe ser llamado una vez.
Definition: resource_manager.cpp:169
Objeto musical de SDL.
Definition: sdl_music.h:13
Singleton para el manager de texturas.
Definition: resource_manager.h:35
SDLMusic & get_music(int id)
Devuelve un objeto SDLMusic.
Definition: resource_manager.cpp:238
Objeto de textura de SDL.
Definition: sdl_texture.h:13
SDLSoundFx & get_sound_fx(int id)
Devuelve un objeto SDLSoundFx.
Definition: resource_manager.cpp:245
static ResourceManager & get_instance()
Devuelve la instancia del resource manager.
Definition: resource_manager.cpp:176
SDLTexture & get_texture(const std::string &type, int id)
Obtiene una textura.
Definition: resource_manager.cpp:181
Sprite animada de SDL.
Definition: sdl_animated_sprite.h:14
SDLSprite & get_sprite(const std::string &type, int id)
Devuelve un sprite.
Definition: resource_manager.cpp:206
TTF_Font * get_font(int id)
Devuelve una fuente de SDL.
Definition: resource_manager.cpp:218
Cargador de texturas de SDL.
Definition: sdl_texture_loader.h:11