67 lines
1.9 KiB
C++
67 lines
1.9 KiB
C++
#include <SDL3/SDL.h>
|
|
|
|
#include <ctime>
|
|
#include <string>
|
|
|
|
#include "core/jail/jail_audio.hpp"
|
|
#include "core/jail/jdraw8.hpp"
|
|
#include "core/jail/jfile.hpp"
|
|
#include "core/jail/jgame.hpp"
|
|
#include "core/locale/locale.hpp"
|
|
#include "core/rendering/menu.hpp"
|
|
#include "core/rendering/overlay.hpp"
|
|
#include "core/rendering/screen.hpp"
|
|
#include "core/system/director.hpp"
|
|
#include "game/options.hpp"
|
|
|
|
int main(int /*argc*/, char* /*args*/[]) {
|
|
srand(unsigned(time(NULL)));
|
|
|
|
// Crea la carpeta de configuració i carrega les opcions
|
|
file_setconfigfolder("jailgames/aee");
|
|
|
|
// Ruta absoluta a data/ basada en la ubicació de l'executable.
|
|
// SDL_GetBasePath() detecta automàticament si estem dins d'un .app bundle
|
|
// (retorna Contents/Resources/) o en un executable normal (carpeta del binari).
|
|
const char* base_path = SDL_GetBasePath();
|
|
if (base_path) {
|
|
std::string data_path = std::string(base_path) + "data/";
|
|
file_setresourcefolder(data_path.c_str());
|
|
}
|
|
Options::setConfigFile(std::string(file_getconfigfolder()) + "config.yaml");
|
|
Options::loadFromFile();
|
|
|
|
// Carrega textos (idioma per defecte: valencià)
|
|
Locale::load("locale/ca.yaml");
|
|
|
|
// Carrega presets de shaders
|
|
Options::setPostFXFile(std::string(file_getconfigfolder()) + "postfx.yaml");
|
|
Options::loadPostFXFromFile();
|
|
Options::setCrtPiFile(std::string(file_getconfigfolder()) + "crtpi.yaml");
|
|
Options::loadCrtPiFromFile();
|
|
|
|
JG_Init();
|
|
Screen::init();
|
|
JD8_Init();
|
|
JA_Init(48000, SDL_AUDIO_S16, 2);
|
|
Options::applyAudio();
|
|
Overlay::init();
|
|
Menu::init();
|
|
Director::init();
|
|
|
|
// Arranca el Director: crea game thread, bucle principal, sincronització de frames
|
|
Director::get()->run();
|
|
|
|
Options::saveToFile();
|
|
|
|
Director::destroy();
|
|
Menu::destroy();
|
|
Overlay::destroy();
|
|
JA_Quit();
|
|
JD8_Quit();
|
|
Screen::destroy();
|
|
JG_Finalize();
|
|
|
|
return 0;
|
|
}
|