54 lines
1.6 KiB
C++
54 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <SDL3/SDL.h> // Para Uint8
|
|
#include <string> // Para string
|
|
#include <vector> // Para vector
|
|
|
|
// --- Constantes ---
|
|
constexpr int TOTAL_DEMO_DATA = 2000;
|
|
|
|
// --- Estructuras ---
|
|
struct DemoKeys {
|
|
Uint8 left;
|
|
Uint8 right;
|
|
Uint8 no_input;
|
|
Uint8 fire;
|
|
Uint8 fire_left;
|
|
Uint8 fire_right;
|
|
|
|
explicit DemoKeys(Uint8 l = 0, Uint8 r = 0, Uint8 ni = 0, Uint8 f = 0, Uint8 fl = 0, Uint8 fr = 0)
|
|
: left(l),
|
|
right(r),
|
|
no_input(ni),
|
|
fire(f),
|
|
fire_left(fl),
|
|
fire_right(fr) {}
|
|
};
|
|
|
|
// --- Tipos ---
|
|
using DemoData = std::vector<DemoKeys>;
|
|
|
|
struct Demo {
|
|
bool enabled = false; // Indica si está activo el modo demo
|
|
bool recording = false; // Indica si está activado el modo para grabar la demo
|
|
float elapsed_s = 0.0F; // Segundos transcurridos de demo
|
|
int index = 0; // Contador para el modo demo
|
|
DemoKeys keys; // Variable con las pulsaciones de teclas del modo demo
|
|
std::vector<DemoData> data; // Vector con diferentes sets de datos con los movimientos para la demo
|
|
|
|
Demo() = default;
|
|
|
|
Demo(bool e, bool r, int c, const DemoKeys& k, const std::vector<DemoData>& d)
|
|
: enabled(e),
|
|
recording(r),
|
|
index(c),
|
|
keys(k),
|
|
data(d) {}
|
|
};
|
|
|
|
// --- Funciones ---
|
|
auto loadDemoDataFromFile(const std::string& file_path) -> DemoData;
|
|
|
|
#ifdef RECORDING
|
|
bool saveDemoFile(const std::string& file_path, const DemoData& dd);
|
|
#endif |