De moment ja compila i executa, encara que no troba alguns fitxers

This commit is contained in:
2025-02-25 23:03:16 +01:00
parent 32c31a8cb6
commit a07a08adb7
45 changed files with 537 additions and 680 deletions

View File

@@ -1,18 +1,19 @@
#include "loading_screen.h"
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include <stdlib.h> // for rand
#include "asset.h" // for Asset
#include "defines.h" // for SECTION_LOADING_SCREEN, SECTION_QUIT
#include "input.h" // for Input, REPEAT_FALSE, inputs_e
#include "jail_audio.h" // for JA_DeleteMusic, JA_LoadMusic, JA_PlayMusic
#include "resource.h" // for Resource
#include "screen.h" // for Screen
#include "sprite.h" // for Sprite
#include "texture.h" // for Texture
#include "utils.h" // for options_t, section_t, color_t, stringToC...
#include "options.h"
#include "global_inputs.h"
#include "global_events.h"
#include <SDL2/SDL_events.h> // for SDL_PollEvent, SDL_Event
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include <stdlib.h> // for rand
#include "asset.h" // for Asset
#include "defines.h" // for GAMECANVAS_HEIGHT, GAMECANVAS_WIDTH
#include "global_events.h" // for check
#include "global_inputs.h" // for check
#include "input.h" // for Input
#include "jail_audio.h" // for JA_PlayMusic, JA_SetVolume, JA_StopMusic
#include "options.h" // for Options, options, OptionsVideo, Section...
#include "resource.h" // for Resource
#include "screen.h" // for Screen
#include "sprite.h" // for Sprite
#include "texture.h" // for Texture
#include "utils.h" // for Color, stringToColor, Palette
// Constructor
LoadingScreen::LoadingScreen()
@@ -66,6 +67,12 @@ LoadingScreen::LoadingScreen()
screen_->setBorderColor(stringToColor(options.video.palette, "black"));
}
// Destructor
LoadingScreen::~LoadingScreen()
{
JA_StopMusic();
}
// Comprueba el manejador de eventos
void LoadingScreen::checkEvents()
{
@@ -88,7 +95,7 @@ void LoadingScreen::updateLoad()
// Primera parte de la carga, la parte en blanco y negro
if (loading_first_part_)
{
// Cada 5 pasos el loadCounter se incrementa en uno
// Cada 5 pasos el load_counter_ se incrementa en uno
const int numSteps = 5;
const int step = 51;
load_counter_ = counter_ / numSteps;
@@ -182,18 +189,10 @@ void LoadingScreen::update()
// Comprueba que la diferencia de ticks sea mayor a la velocidad del juego
if (SDL_GetTicks() - ticks_ > ticks_speed_)
{
// Actualiza el contador de ticks
ticks_ = SDL_GetTicks();
// Comprueba las entradas
checkInput();
// Gestiona el contador interno
updateCounter();
// Gestiona el contador de carga
updateLoad();
screen_->update();
}
}