Integrada la clase asset. Corregidos algunos fallos en el bucle principal

This commit is contained in:
2022-08-09 13:58:32 +02:00
parent ff341d8cee
commit 4d1a08a300
8 changed files with 130 additions and 194 deletions

View File

@@ -1,5 +1,6 @@
#pragma once
#include "animatedsprite.h"
#include "asset.h"
#include "jail_audio.h"
#include "utils.h"
@@ -9,29 +10,11 @@
// The player
class Map
{
public:
// Constructor
Map(SDL_Renderer *renderer, LTexture *texture1, LTexture *texture2, LTexture *texture3, std::string file);
// Destructor
~Map();
// Inicializa todas las variables
void init(SDL_Renderer *renderer, LTexture *texture1, LTexture *texture2, LTexture *texture3, std::string file);
// Carga el mapa a partir de un fichero
void loadFromFile(std::string file);
// Resetea ciertas variables
void reset();
// Actualiza todas las variables
void update();
// Dibuja el objeto
void render();
private:
LTexture *texture_tile; // Textura con los gráficos de los tiles
LTexture *texture_actor; // Textura con los gráficos de los actores
LTexture *texture_bg; // Textura con los gráficos de fondo
Asset *asset; // Objeto con los ficheros de recursos
AnimatedSprite *sprite_tile; // Sprite de los tiles del mapa
AnimatedSprite *sprite_actor; // Sprite de los actores
Sprite *background; // Fondo de la pantalla
@@ -43,6 +26,22 @@ private:
Uint8 h; // Altura en habitaciones del mapa
Uint8 room; // Habitación actual del mapa
std::string mapfile; // Ruta con el fichero del mapa
public:
// Constructor
Map(SDL_Renderer *renderer, std::string file, Asset *asset);
// Destructor
~Map();
// Carga el mapa a partir de un fichero
void loadFromFile(std::string file);
// Actualiza todas las variables
void update();
// Dibuja el objeto
void render();
};
#endif