forked from jaildesigner-jailgames/jaildoctors_dilemma
demo.cpp a fer la mar
This commit is contained in:
@@ -1,21 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL_events.h> // for SDL_Event
|
||||
#include <SDL2/SDL_rect.h> // for SDL_Rect
|
||||
#include <SDL2/SDL_render.h> // for SDL_Texture
|
||||
#include <SDL2/SDL_stdinc.h> // for Uint32
|
||||
#include <memory> // for shared_ptr
|
||||
#include <string> // for string
|
||||
#include "player.h" // for PlayerSpawn
|
||||
class Room; // lines 17-17
|
||||
class RoomTracker; // lines 18-18
|
||||
class Scoreboard;
|
||||
class Stats; // lines 20-20
|
||||
struct ScoreboardData;
|
||||
#include <SDL2/SDL_events.h> // for SDL_Event
|
||||
#include <SDL2/SDL_rect.h> // for SDL_Rect
|
||||
#include <SDL2/SDL_render.h> // for SDL_Texture
|
||||
#include <SDL2/SDL_stdinc.h> // for Uint32
|
||||
#include <memory> // for shared_ptr
|
||||
#include <string> // for string
|
||||
#include <vector> // for vector
|
||||
#include "player.h" // for PlayerSpawn
|
||||
class Room; // lines 10-10
|
||||
class RoomTracker; // lines 11-11
|
||||
class Scoreboard; // lines 12-12
|
||||
class Stats; // lines 13-13
|
||||
struct ScoreboardData; // lines 14-14
|
||||
|
||||
enum class GameMode
|
||||
{
|
||||
DEMO,
|
||||
GAME
|
||||
};
|
||||
|
||||
class Game
|
||||
{
|
||||
private:
|
||||
// Estructuras
|
||||
struct DemoData
|
||||
{
|
||||
int counter; // Contador para el modo demo
|
||||
int room_time; // Tiempo que se muestra cada habitación
|
||||
int room_index; // Índice para el vector de habitaciones
|
||||
std::vector<std::string> rooms; // Listado con los mapas de la demo
|
||||
|
||||
// Constructor por defecto
|
||||
DemoData()
|
||||
: counter(0), room_time(0), room_index(0), rooms({}) {}
|
||||
|
||||
// Constructor parametrizado
|
||||
DemoData(int counter, int room_time, int room_index, const std::vector<std::string> &rooms)
|
||||
: counter(counter), room_time(room_time), room_index(room_index), rooms(rooms) {}
|
||||
};
|
||||
|
||||
// Objetos y punteros
|
||||
std::shared_ptr<ScoreboardData> board_; // Estructura con los datos del marcador
|
||||
std::shared_ptr<Scoreboard> scoreboard_; // Objeto encargado de gestionar el marcador
|
||||
@@ -26,6 +50,8 @@ private:
|
||||
SDL_Texture *room_name_texture_; // Textura para escribir el nombre de la habitación
|
||||
|
||||
// Variables
|
||||
GameMode mode_; // Modo del juego
|
||||
DemoData demo_; // Variables para el modo demo
|
||||
Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa
|
||||
std::string current_room_; // Fichero de la habitación actual
|
||||
PlayerSpawn spawn_point_; // Lugar de la habitación donde aparece el jugador
|
||||
@@ -124,9 +150,15 @@ private:
|
||||
// Crea la textura para poner el nombre de la habitación
|
||||
void createRoomNameTexture();
|
||||
|
||||
// DEMO MODE: Inicializa las variables para el modo demo
|
||||
void DEMO_init();
|
||||
|
||||
// DEMO MODE: Comprueba si se ha de cambiar de habitación
|
||||
void DEMO_checkRoomChange();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Game();
|
||||
Game(GameMode mode);
|
||||
|
||||
// Destructor
|
||||
~Game();
|
||||
|
||||
Reference in New Issue
Block a user