clang-format
mogudes coses de config.yaml a debug.yaml
This commit is contained in:
@@ -226,7 +226,9 @@ inline JA_Music_t* JA_LoadMusic(const Uint8* buffer, Uint32 length) {
|
|||||||
|
|
||||||
int error = 0;
|
int error = 0;
|
||||||
music->vorbis = stb_vorbis_open_memory(music->ogg_data.data(),
|
music->vorbis = stb_vorbis_open_memory(music->ogg_data.data(),
|
||||||
static_cast<int>(length), &error, nullptr);
|
static_cast<int>(length),
|
||||||
|
&error,
|
||||||
|
nullptr);
|
||||||
if (!music->vorbis) {
|
if (!music->vorbis) {
|
||||||
SDL_Log("JA_LoadMusic: stb_vorbis_open_memory failed (error %d)", error);
|
SDL_Log("JA_LoadMusic: stb_vorbis_open_memory failed (error %d)", error);
|
||||||
delete music;
|
delete music;
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ void ModuleGame::onEnter() {
|
|||||||
strcmp(music, current_music) != 0) {
|
strcmp(music, current_music) != 0) {
|
||||||
auto buffer = ResourceHelper::loadFile(music);
|
auto buffer = ResourceHelper::loadFile(music);
|
||||||
JA_PlayMusic(JA_LoadMusic(buffer.data(),
|
JA_PlayMusic(JA_LoadMusic(buffer.data(),
|
||||||
static_cast<Uint32>(buffer.size()), music));
|
static_cast<Uint32>(buffer.size()),
|
||||||
|
music));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Arranca el fade-in tick-based. El `PaletteFade` avança un pas (de
|
// Arranca el fade-in tick-based. El `PaletteFade` avança un pas (de
|
||||||
|
|||||||
@@ -16,6 +16,66 @@ namespace Options {
|
|||||||
config_file_path = path;
|
config_file_path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setDebugFile(const std::string& path) {
|
||||||
|
debug_file_path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto saveDebugToFile() -> bool {
|
||||||
|
std::ofstream file(debug_file_path);
|
||||||
|
if (!file.is_open()) {
|
||||||
|
std::cerr << "Error: Unable to open file " << debug_file_path << " for writing\n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "Writing debug file: " << debug_file_path << '\n';
|
||||||
|
|
||||||
|
file << "# Aventures En Egipte - Debug Configuration File\n";
|
||||||
|
file << "#\n";
|
||||||
|
file << "# Loaded only in debug builds. Override gameplay starting state for testing.\n";
|
||||||
|
file << "\n";
|
||||||
|
file << "game:\n";
|
||||||
|
file << " habitacio_inicial: " << game.habitacio_inicial << "\n";
|
||||||
|
file << " piramide_inicial: " << game.piramide_inicial << "\n";
|
||||||
|
file << " vides: " << game.vides << "\n";
|
||||||
|
file << " diamants_inicial: " << game.diamants_inicial << "\n";
|
||||||
|
file << " diners_inicial: " << game.diners_inicial << "\n";
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto loadDebugFromFile() -> bool {
|
||||||
|
std::ifstream file(debug_file_path);
|
||||||
|
if (!file.good()) {
|
||||||
|
std::cout << "Debug file not found, creating default: " << debug_file_path << '\n';
|
||||||
|
return saveDebugToFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string content((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
try {
|
||||||
|
std::cout << "Reading debug file: " << debug_file_path << '\n';
|
||||||
|
auto yaml = fkyaml::node::deserialize(content);
|
||||||
|
if (yaml.contains("game")) {
|
||||||
|
const auto& node = yaml["game"];
|
||||||
|
if (node.contains("habitacio_inicial"))
|
||||||
|
game.habitacio_inicial = node["habitacio_inicial"].get_value<int>();
|
||||||
|
if (node.contains("piramide_inicial"))
|
||||||
|
game.piramide_inicial = node["piramide_inicial"].get_value<int>();
|
||||||
|
if (node.contains("vides"))
|
||||||
|
game.vides = node["vides"].get_value<int>();
|
||||||
|
if (node.contains("diamants_inicial"))
|
||||||
|
game.diamants_inicial = node["diamants_inicial"].get_value<int>();
|
||||||
|
if (node.contains("diners_inicial"))
|
||||||
|
game.diners_inicial = node["diners_inicial"].get_value<int>();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (const fkyaml::exception& e) {
|
||||||
|
std::cerr << "Error parsing YAML debug: " << e.what() << '\n';
|
||||||
|
return saveDebugToFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void applyAudio() {
|
void applyAudio() {
|
||||||
const float master = audio.enabled ? audio.volume : 0.0F;
|
const float master = audio.enabled ? audio.volume : 0.0F;
|
||||||
JA_EnableMusic(audio.music_enabled);
|
JA_EnableMusic(audio.music_enabled);
|
||||||
@@ -138,16 +198,6 @@ namespace Options {
|
|||||||
if (!yaml.contains("game")) return;
|
if (!yaml.contains("game")) return;
|
||||||
const auto& node = yaml["game"];
|
const auto& node = yaml["game"];
|
||||||
|
|
||||||
if (node.contains("habitacio_inicial"))
|
|
||||||
game.habitacio_inicial = node["habitacio_inicial"].get_value<int>();
|
|
||||||
if (node.contains("piramide_inicial"))
|
|
||||||
game.piramide_inicial = node["piramide_inicial"].get_value<int>();
|
|
||||||
if (node.contains("vides"))
|
|
||||||
game.vides = node["vides"].get_value<int>();
|
|
||||||
if (node.contains("diamants_inicial"))
|
|
||||||
game.diamants_inicial = node["diamants_inicial"].get_value<int>();
|
|
||||||
if (node.contains("diners_inicial"))
|
|
||||||
game.diners_inicial = node["diners_inicial"].get_value<int>();
|
|
||||||
if (node.contains("use_new_logo"))
|
if (node.contains("use_new_logo"))
|
||||||
game.use_new_logo = node["use_new_logo"].get_value<bool>();
|
game.use_new_logo = node["use_new_logo"].get_value<bool>();
|
||||||
if (node.contains("show_title_credits"))
|
if (node.contains("show_title_credits"))
|
||||||
@@ -279,11 +329,6 @@ namespace Options {
|
|||||||
// GAME
|
// GAME
|
||||||
file << "# GAME\n";
|
file << "# GAME\n";
|
||||||
file << "game:\n";
|
file << "game:\n";
|
||||||
file << " habitacio_inicial: " << game.habitacio_inicial << "\n";
|
|
||||||
file << " piramide_inicial: " << game.piramide_inicial << "\n";
|
|
||||||
file << " vides: " << game.vides << "\n";
|
|
||||||
file << " diamants_inicial: " << game.diamants_inicial << "\n";
|
|
||||||
file << " diners_inicial: " << game.diners_inicial << "\n";
|
|
||||||
file << " use_new_logo: " << (game.use_new_logo ? "true" : "false") << "\n";
|
file << " use_new_logo: " << (game.use_new_logo ? "true" : "false") << "\n";
|
||||||
file << " show_title_credits: " << (game.show_title_credits ? "true" : "false") << "\n";
|
file << " show_title_credits: " << (game.show_title_credits ? "true" : "false") << "\n";
|
||||||
file << "\n";
|
file << "\n";
|
||||||
|
|||||||
@@ -141,11 +141,21 @@ namespace Options {
|
|||||||
inline std::string crtpi_file_path{};
|
inline std::string crtpi_file_path{};
|
||||||
inline int current_crtpi_preset{0};
|
inline int current_crtpi_preset{0};
|
||||||
|
|
||||||
|
inline std::string debug_file_path{};
|
||||||
|
|
||||||
// --- API ---
|
// --- API ---
|
||||||
void setConfigFile(const std::string& path);
|
void setConfigFile(const std::string& path);
|
||||||
auto loadFromFile() -> bool;
|
auto loadFromFile() -> bool;
|
||||||
auto saveToFile() -> bool;
|
auto saveToFile() -> bool;
|
||||||
|
|
||||||
|
// debug.yaml: estat inicial de gameplay per a tests ràpids
|
||||||
|
// (`habitacio_inicial`, `piramide_inicial`, `vides`, `diamants_inicial`,
|
||||||
|
// `diners_inicial`). Només es carrega/desa en builds de debug; en release
|
||||||
|
// els camps queden als seus defaults.
|
||||||
|
void setDebugFile(const std::string& path);
|
||||||
|
auto loadDebugFromFile() -> bool;
|
||||||
|
auto saveDebugToFile() -> bool;
|
||||||
|
|
||||||
void setPostFXFile(const std::string& path);
|
void setPostFXFile(const std::string& path);
|
||||||
auto loadPostFXFromFile() -> bool;
|
auto loadPostFXFromFile() -> bool;
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,13 @@ SDL_AppResult SDL_AppInit(void** /*appstate*/, int /*argc*/, char* /*argv*/[]) {
|
|||||||
Options::setConfigFile(std::string(file_getconfigfolder()) + "config.yaml");
|
Options::setConfigFile(std::string(file_getconfigfolder()) + "config.yaml");
|
||||||
Options::loadFromFile();
|
Options::loadFromFile();
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
// debug.yaml: estat inicial de gameplay per a tests ràpids,
|
||||||
|
// només en builds de debug.
|
||||||
|
Options::setDebugFile(std::string(file_getconfigfolder()) + "debug.yaml");
|
||||||
|
Options::loadDebugFromFile();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
// MEMFS no persistix entre recàrregues: força valors sensats per a web.
|
// MEMFS no persistix entre recàrregues: força valors sensats per a web.
|
||||||
Options::window.fullscreen = false;
|
Options::window.fullscreen = false;
|
||||||
@@ -112,6 +119,9 @@ void SDL_AppQuit(void* /*appstate*/, SDL_AppResult /*result*/) {
|
|||||||
Director::get()->teardown();
|
Director::get()->teardown();
|
||||||
|
|
||||||
Options::saveToFile();
|
Options::saveToFile();
|
||||||
|
#ifndef NDEBUG
|
||||||
|
Options::saveDebugToFile();
|
||||||
|
#endif
|
||||||
|
|
||||||
Director::destroy();
|
Director::destroy();
|
||||||
Menu::destroy();
|
Menu::destroy();
|
||||||
|
|||||||
@@ -18,7 +18,14 @@ struct CocheFrame {
|
|||||||
};
|
};
|
||||||
|
|
||||||
constexpr CocheFrame COCHE_FRAMES[8] = {
|
constexpr CocheFrame COCHE_FRAMES[8] = {
|
||||||
{214, 152}, {214, 104}, {214, 56}, {214, 104}, {214, 152}, {214, 8}, {108, 152}, {214, 8},
|
{214, 152},
|
||||||
|
{214, 104},
|
||||||
|
{214, 56},
|
||||||
|
{214, 104},
|
||||||
|
{214, 152},
|
||||||
|
{214, 8},
|
||||||
|
{108, 152},
|
||||||
|
{214, 8},
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr int CONTADOR_MAX = 3100; // ~62 s de crèdits a 20 ms/tick
|
constexpr int CONTADOR_MAX = 3100; // ~62 s de crèdits a 20 ms/tick
|
||||||
|
|||||||
@@ -72,19 +72,16 @@ void IntroNewLogoScene::render() {
|
|||||||
|
|
||||||
case Phase::Revealing: {
|
case Phase::Revealing: {
|
||||||
JD8_ClearScreen(0);
|
JD8_ClearScreen(0);
|
||||||
JD8_Blit(LOGO_SRC_X, LOGO_DST_Y, gfx_, LOGO_SRC_X, LOGO_SRC_Y,
|
JD8_Blit(LOGO_SRC_X, LOGO_DST_Y, gfx_, LOGO_SRC_X, LOGO_SRC_Y, LETTER_WIDTHS[reveal_letter_], LOGO_HEIGHT);
|
||||||
LETTER_WIDTHS[reveal_letter_], LOGO_HEIGHT);
|
|
||||||
if (reveal_cursor_visible_) {
|
if (reveal_cursor_visible_) {
|
||||||
JD8_Blit(CURSOR_X[reveal_letter_], CURSOR_Y, cursor_surf_,
|
JD8_Blit(CURSOR_X[reveal_letter_], CURSOR_Y, cursor_surf_, 0, 0, CURSOR_W, CURSOR_H);
|
||||||
0, 0, CURSOR_W, CURSOR_H);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Phase::FullLogoFlash:
|
case Phase::FullLogoFlash:
|
||||||
JD8_ClearScreen(0);
|
JD8_ClearScreen(0);
|
||||||
JD8_Blit(LOGO_SRC_X, LOGO_DST_Y, gfx_, LOGO_SRC_X, LOGO_SRC_Y,
|
JD8_Blit(LOGO_SRC_X, LOGO_DST_Y, gfx_, LOGO_SRC_X, LOGO_SRC_Y, LETTER_WIDTHS[8], LOGO_HEIGHT);
|
||||||
LETTER_WIDTHS[8], LOGO_HEIGHT);
|
|
||||||
JD8_Blit(CURSOR_X[8], CURSOR_Y, cursor_surf_, 0, 0, CURSOR_W, CURSOR_H);
|
JD8_Blit(CURSOR_X[8], CURSOR_Y, cursor_surf_, 0, 0, CURSOR_W, CURSOR_H);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -93,8 +90,7 @@ void IntroNewLogoScene::render() {
|
|||||||
// Logo complet sense cursor — els pixels del cursor
|
// Logo complet sense cursor — els pixels del cursor
|
||||||
// ciclarien de color durant el cicle de paleta.
|
// ciclarien de color durant el cicle de paleta.
|
||||||
JD8_ClearScreen(0);
|
JD8_ClearScreen(0);
|
||||||
JD8_Blit(LOGO_SRC_X, LOGO_DST_Y, gfx_, LOGO_SRC_X, LOGO_SRC_Y,
|
JD8_Blit(LOGO_SRC_X, LOGO_DST_Y, gfx_, LOGO_SRC_X, LOGO_SRC_Y, LETTER_WIDTHS[8], LOGO_HEIGHT);
|
||||||
LETTER_WIDTHS[8], LOGO_HEIGHT);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Phase::Sprites:
|
case Phase::Sprites:
|
||||||
|
|||||||
@@ -22,11 +22,24 @@ constexpr Uint16 fr1[] = {0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 18
|
|||||||
constexpr Uint16 fr2[] = {0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180}; // camina esquerra (y=15)
|
constexpr Uint16 fr2[] = {0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180}; // camina esquerra (y=15)
|
||||||
constexpr Uint16 fr3[] = {0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150}; // trau mapa dreta (y=30)
|
constexpr Uint16 fr3[] = {0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150}; // trau mapa dreta (y=30)
|
||||||
constexpr Uint16 fr4[] = {0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150}; // trau mapa esquerra (y=45)
|
constexpr Uint16 fr4[] = {0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150}; // trau mapa esquerra (y=45)
|
||||||
constexpr Uint16 fr5[] = {165, 180, 195, 210, 225, 240, 255, 270, 285, 300,
|
constexpr Uint16 fr5[] = {165, 180, 195, 210, 225, 240, 255, 270, 285, 300, 300, 285, 270, 255, 240, 225, 210, 195, 180, 165}; // bot de susto (y=45, mirror)
|
||||||
300, 285, 270, 255, 240, 225, 210, 195, 180, 165}; // bot de susto (y=45, mirror)
|
|
||||||
constexpr Uint16 fr6[] = {0, 15, 30, 45, 60, 75, 90, 105}; // momia (y=60)
|
constexpr Uint16 fr6[] = {0, 15, 30, 45, 60, 75, 90, 105}; // momia (y=60)
|
||||||
constexpr Uint16 fr7[] = {75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225, 240, 255, 270, // paper (y=75, idx 0..13)
|
constexpr Uint16 fr7[] = {75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225, 240, 255, 270, // paper (y=75, idx 0..13)
|
||||||
0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 210}; // sombra (y=105, idx 14..28)
|
0,
|
||||||
|
15,
|
||||||
|
30,
|
||||||
|
45,
|
||||||
|
60,
|
||||||
|
75,
|
||||||
|
90,
|
||||||
|
105,
|
||||||
|
120,
|
||||||
|
135,
|
||||||
|
150,
|
||||||
|
165,
|
||||||
|
180,
|
||||||
|
195,
|
||||||
|
210}; // sombra (y=105, idx 14..28)
|
||||||
constexpr Uint16 fr8[] = {15, 30, 45, 60}; // pedra (y=75)
|
constexpr Uint16 fr8[] = {15, 30, 45, 60}; // pedra (y=75)
|
||||||
constexpr Uint16 fr9[] = {0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225}; // prota ball (y=120)
|
constexpr Uint16 fr9[] = {0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225}; // prota ball (y=120)
|
||||||
constexpr Uint16 fr10[] = {0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225}; // momia ball (y=135)
|
constexpr Uint16 fr10[] = {0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225}; // momia ball (y=135)
|
||||||
@@ -266,18 +279,24 @@ constexpr SpritePhase variant_2[] = {
|
|||||||
|
|
||||||
const SpritePhase* variant_table(int variant) {
|
const SpritePhase* variant_table(int variant) {
|
||||||
switch (variant) {
|
switch (variant) {
|
||||||
case 0: return variant_0;
|
case 0:
|
||||||
case 1: return variant_1;
|
return variant_0;
|
||||||
case 2: return variant_2;
|
case 1:
|
||||||
|
return variant_1;
|
||||||
|
case 2:
|
||||||
|
return variant_2;
|
||||||
}
|
}
|
||||||
return variant_0;
|
return variant_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int variant_length(int variant) {
|
int variant_length(int variant) {
|
||||||
switch (variant) {
|
switch (variant) {
|
||||||
case 0: return sizeof(variant_0) / sizeof(variant_0[0]);
|
case 0:
|
||||||
case 1: return sizeof(variant_1) / sizeof(variant_1[0]);
|
return sizeof(variant_0) / sizeof(variant_0[0]);
|
||||||
case 2: return sizeof(variant_2) / sizeof(variant_2[0]);
|
case 1:
|
||||||
|
return sizeof(variant_1) / sizeof(variant_1[0]);
|
||||||
|
case 2:
|
||||||
|
return sizeof(variant_2) / sizeof(variant_2[0]);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ void playMusic(const char* filename, int loop) {
|
|||||||
// JA_LoadMusic fa una còpia interna del OGG comprimit (via SDL_malloc)
|
// JA_LoadMusic fa una còpia interna del OGG comprimit (via SDL_malloc)
|
||||||
// per a stb_vorbis. El `buffer` local es destruirà en sortir d'àmbit.
|
// per a stb_vorbis. El `buffer` local es destruirà en sortir d'àmbit.
|
||||||
JA_PlayMusic(JA_LoadMusic(buffer.data(),
|
JA_PlayMusic(JA_LoadMusic(buffer.data(),
|
||||||
static_cast<Uint32>(buffer.size()), filename),
|
static_cast<Uint32>(buffer.size()),
|
||||||
|
filename),
|
||||||
loop);
|
loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,8 +118,7 @@ void SlidesScene::tick(int delta_ms) {
|
|||||||
const int slide_idx = (phase_ == Phase::Slide1Enter ? 0
|
const int slide_idx = (phase_ == Phase::Slide1Enter ? 0
|
||||||
: phase_ == Phase::Slide2Enter ? 1
|
: phase_ == Phase::Slide2Enter ? 1
|
||||||
: 2);
|
: 2);
|
||||||
const float t = std::min(1.0f, static_cast<float>(phase_acc_ms_) /
|
const float t = std::min(1.0f, static_cast<float>(phase_acc_ms_) / static_cast<float>(SCROLL_MS));
|
||||||
static_cast<float>(SCROLL_MS));
|
|
||||||
const float eased = Easing::outCubic(t);
|
const float eased = Easing::outCubic(t);
|
||||||
const int pos_x = Easing::lerpInt(SLIDE_START_X[slide_idx], 0, eased);
|
const int pos_x = Easing::lerpInt(SLIDE_START_X[slide_idx], 0, eased);
|
||||||
drawSlide(slide_idx, pos_x);
|
drawSlide(slide_idx, pos_x);
|
||||||
@@ -127,9 +126,12 @@ void SlidesScene::tick(int delta_ms) {
|
|||||||
if (phase_acc_ms_ >= SCROLL_MS) {
|
if (phase_acc_ms_ >= SCROLL_MS) {
|
||||||
// Garanteix posició final exacta (pos_x=0).
|
// Garanteix posició final exacta (pos_x=0).
|
||||||
drawSlide(slide_idx, 0);
|
drawSlide(slide_idx, 0);
|
||||||
if (phase_ == Phase::Slide1Enter) phase_ = Phase::Slide1Hold;
|
if (phase_ == Phase::Slide1Enter)
|
||||||
else if (phase_ == Phase::Slide2Enter) phase_ = Phase::Slide2Hold;
|
phase_ = Phase::Slide1Hold;
|
||||||
else phase_ = Phase::Slide3Hold;
|
else if (phase_ == Phase::Slide2Enter)
|
||||||
|
phase_ = Phase::Slide2Hold;
|
||||||
|
else
|
||||||
|
phase_ = Phase::Slide3Hold;
|
||||||
phase_acc_ms_ = 0;
|
phase_acc_ms_ = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -140,8 +142,10 @@ void SlidesScene::tick(int delta_ms) {
|
|||||||
phase_acc_ms_ += delta_ms;
|
phase_acc_ms_ += delta_ms;
|
||||||
if (phase_acc_ms_ >= HOLD_MS) {
|
if (phase_acc_ms_ >= HOLD_MS) {
|
||||||
fade_.startFadeOut();
|
fade_.startFadeOut();
|
||||||
if (phase_ == Phase::Slide1Hold) phase_ = Phase::FadeOut1;
|
if (phase_ == Phase::Slide1Hold)
|
||||||
else phase_ = Phase::FadeOut2;
|
phase_ = Phase::FadeOut1;
|
||||||
|
else
|
||||||
|
phase_ = Phase::FadeOut2;
|
||||||
phase_acc_ms_ = 0;
|
phase_acc_ms_ = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -159,8 +163,10 @@ void SlidesScene::tick(int delta_ms) {
|
|||||||
if (fade_.done()) {
|
if (fade_.done()) {
|
||||||
restorePalette();
|
restorePalette();
|
||||||
JD8_ClearScreen(BG_COLOR_INDEX);
|
JD8_ClearScreen(BG_COLOR_INDEX);
|
||||||
if (phase_ == Phase::FadeOut1) phase_ = Phase::Slide2Enter;
|
if (phase_ == Phase::FadeOut1)
|
||||||
else phase_ = Phase::Slide3Enter;
|
phase_ = Phase::Slide2Enter;
|
||||||
|
else
|
||||||
|
phase_ = Phase::Slide3Enter;
|
||||||
phase_acc_ms_ = 0;
|
phase_acc_ms_ = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ class SpriteMover {
|
|||||||
SpriteMover() = default;
|
SpriteMover() = default;
|
||||||
|
|
||||||
// Arrenca un moviment nou. Si ja n'hi havia un en curs, es descarta.
|
// Arrenca un moviment nou. Si ja n'hi havia un en curs, es descarta.
|
||||||
void moveTo(int x0, int y0, int x1, int y1, int duration_ms,
|
void moveTo(int x0, int y0, int x1, int y1, int duration_ms, EaseFn ease = Easing::linear);
|
||||||
EaseFn ease = Easing::linear);
|
|
||||||
|
|
||||||
// Posicionament immediat (útil per a "teleportar" entre moviments).
|
// Posicionament immediat (útil per a "teleportar" entre moviments).
|
||||||
void setPosition(int x, int y);
|
void setPosition(int x, int y);
|
||||||
|
|||||||
Reference in New Issue
Block a user