59 lines
2.1 KiB
C++
59 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include <SDL3/SDL.h>
|
|
|
|
#include <cstdint> // for uint8_t
|
|
#include <memory>
|
|
#include <string> // for string, basic_string
|
|
class Game;
|
|
class Intro;
|
|
class Logo;
|
|
class Title;
|
|
struct Section;
|
|
|
|
class Director {
|
|
public:
|
|
Director(int argc, const char *argv[]); // Constructor
|
|
~Director(); // Destructor
|
|
|
|
Director(const Director &) = delete;
|
|
auto operator=(const Director &) -> Director & = delete;
|
|
|
|
auto iterate() -> SDL_AppResult; // Ejecuta un frame del juego
|
|
auto handleEvent(SDL_Event *event) -> SDL_AppResult; // Procesa un evento
|
|
|
|
private:
|
|
// Secciones activas del Director
|
|
enum class ActiveSection : std::uint8_t {
|
|
NONE,
|
|
LOGO,
|
|
INTRO,
|
|
TITLE,
|
|
GAME
|
|
};
|
|
|
|
static void initJailAudio(); // Inicializa jail_audio
|
|
auto initSDL() -> bool; // Arranca SDL y crea la ventana
|
|
static void initInput(); // Inicializa el objeto input
|
|
auto setFileList() -> bool; // Crea el indice de ficheros
|
|
static void checkProgramArguments(int argc, const char *argv[]); // Comprueba los parametros del programa
|
|
void createSystemFolder(const std::string &folder); // Crea la carpeta del sistema donde guardar datos
|
|
void handleSectionTransition(); // Gestiona las transiciones entre secciones
|
|
|
|
// Objetos y punteros
|
|
SDL_Window *window_; // La ventana donde dibujamos
|
|
SDL_Renderer *renderer_; // El renderizador de la ventana
|
|
Section *section_; // Sección y subsección actual del programa;
|
|
|
|
// Secciones del juego
|
|
ActiveSection active_section_;
|
|
std::unique_ptr<Logo> logo_;
|
|
std::unique_ptr<Intro> intro_;
|
|
std::unique_ptr<Title> title_;
|
|
std::unique_ptr<Game> game_;
|
|
|
|
// Variables
|
|
std::string executable_path_; // Path del ejecutable
|
|
std::string system_folder_; // Carpeta del sistema donde guardar datos
|
|
};
|