75 lines
1.7 KiB
C++
75 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <SDL3/SDL.h>
|
|
|
|
#include <memory>
|
|
#include <string> // for string, basic_string
|
|
class Game;
|
|
class Intro;
|
|
class Logo;
|
|
class Title;
|
|
struct section_t;
|
|
|
|
// Secciones activas del Director
|
|
enum class ActiveSection { None,
|
|
Logo,
|
|
Intro,
|
|
Title,
|
|
Game };
|
|
|
|
class Director {
|
|
private:
|
|
// Objetos y punteros
|
|
SDL_Window *window; // La ventana donde dibujamos
|
|
SDL_Renderer *renderer; // El renderizador de la ventana
|
|
section_t *section; // Sección y subsección actual del programa;
|
|
|
|
// Secciones del juego
|
|
ActiveSection activeSection;
|
|
std::unique_ptr<Logo> logo;
|
|
std::unique_ptr<Intro> intro;
|
|
std::unique_ptr<Title> title;
|
|
std::unique_ptr<Game> game;
|
|
|
|
// Variables
|
|
std::string executablePath; // Path del ejecutable
|
|
std::string systemFolder; // Carpeta del sistema donde guardar datos
|
|
|
|
// Inicializa jail_audio
|
|
void initJailAudio();
|
|
|
|
// Arranca SDL y crea la ventana
|
|
bool initSDL();
|
|
|
|
// Inicializa el objeto input
|
|
void initInput();
|
|
|
|
// Crea el indice de ficheros
|
|
bool setFileList();
|
|
|
|
// Comprueba los parametros del programa
|
|
void checkProgramArguments(int argc, const char *argv[]);
|
|
|
|
// Crea la carpeta del sistema donde guardar datos
|
|
void createSystemFolder(const std::string &folder);
|
|
|
|
// Gestiona las transiciones entre secciones
|
|
void handleSectionTransition();
|
|
|
|
public:
|
|
// Constructor
|
|
Director(int argc, const char *argv[]);
|
|
|
|
// Destructor
|
|
~Director();
|
|
|
|
Director(const Director &) = delete;
|
|
Director &operator=(const Director &) = delete;
|
|
|
|
// Ejecuta un frame del juego
|
|
SDL_AppResult iterate();
|
|
|
|
// Procesa un evento
|
|
SDL_AppResult handleEvent(SDL_Event *event);
|
|
};
|