Afegit mouse.cpp per amagar el cursor quan no està moventse

This commit is contained in:
2025-01-03 23:35:48 +01:00
parent 08dfaf7641
commit b586a117c8
10 changed files with 109 additions and 19 deletions

View File

@@ -35,7 +35,7 @@
#include "tabe.h" // Para Tabe
#include "text.h" // Para Text
#include "texture.h" // Para Texture
#include <iostream>
#include "mouse.h"
struct JA_Sound_t; // lines 37-37
// Constructor
@@ -1270,6 +1270,8 @@ void Game::checkEvents()
}
}
#endif
// Comprueba el cursor
Mouse::handleEvent(event);
}
}
@@ -1625,11 +1627,16 @@ void Game::initDemo(int player_id)
{
if (demo_.enabled)
{
// Cambia el estado del juego
state_ = GameState::PLAYING;
// Aleatoriza la asignación del fichero con los datos del modo demostracion
const auto demo1 = rand() % 2;
const auto demo2 = (demo1 == 0) ? 1 : 0;
demo_.data.emplace_back(Resource::get()->getDemoData(demo1));
demo_.data.emplace_back(Resource::get()->getDemoData(demo2));
{
const auto demo1 = rand() % 2;
const auto demo2 = (demo1 == 0) ? 1 : 0;
demo_.data.emplace_back(Resource::get()->getDemoData(demo1));
demo_.data.emplace_back(Resource::get()->getDemoData(demo2));
}
// Selecciona una pantalla al azar
{
@@ -1645,8 +1652,13 @@ void Game::initDemo(int player_id)
Stage::total_power += Stage::get(i).power_to_complete;
}
// Pone al jugador en estado jugar
{
getPlayer(player_id)->setPlayingState(PlayerState::PLAYING);
}
// Activa o no al otro jugador
if (rand() % 2 == 0)
if (rand() % 3 != 0)
{
const auto other_player_id = player_id == 1 ? 2 : 1;
auto other_player = getPlayer(other_player_id);
@@ -1804,9 +1816,15 @@ void Game::updateDemo()
{
if (demo_.enabled)
{
// Actualiza ambos fades
fade_in_->update();
fade_out_->update();
// Incrementa el contador de la demo
if (demo_.counter < TOTAL_DEMO_DATA)
{
demo_.counter++;
}
// Activa el fundido antes de acabar con los datos de la demo
if (demo_.counter == TOTAL_DEMO_DATA - 200)
@@ -1871,7 +1889,7 @@ void Game::updateGameStateEnteringPlayer()
{
state_ = GameState::SHOWING_GET_READY_MESSAGE;
createMessage({paths_.at(0), paths_.at(1)}, Resource::get()->getTexture("game_text_get_ready"));
//JA_PlaySound(Resource::get()->getSound("voice_get_ready.wav"));
JA_PlaySound(Resource::get()->getSound("voice_get_ready.wav"));
}
}
}