unificats els resources en un namespace

This commit is contained in:
2025-11-11 10:04:57 +01:00
parent 1821b84e73
commit 54fc6d2902
35 changed files with 356 additions and 341 deletions

View File

@@ -9,7 +9,7 @@
#include "core/audio/audio.hpp" // Para Audio
#include "core/input/input.hpp" // Para Input, InputAction
#include "core/rendering/surface_animated_sprite.hpp" // Para SAnimatedSprite
#include "core/resources/resource.hpp" // Para Resource
#include "core/resources/resource_cache.hpp" // Para Resource
#include "game/gameplay/room.hpp" // Para Room, TileType
#include "game/options.hpp" // Para Cheat, Options, options
#include "utils/defines.hpp" // Para RoomBorder::BOTTOM, RoomBorder::LEFT, RoomBorder::RIGHT
@@ -196,7 +196,7 @@ void Player::handleState(float delta_time) {
} else if (state_ == State::STANDING) {
// Si no tiene suelo debajo y no está en rampa descendente -> FALLING
if (!isOnFloor() && !isOnConveyorBelt() && !isOnDownSlope()) {
transitionToState(State::FALLING); // setState() establece vx_=0, vy_=MAX_VY
transitionToState(State::FALLING); // setState() establece vx_=0, vy_=MAX_VY
}
} else if (state_ == State::JUMPING) {
playJumpSound(delta_time);
@@ -545,10 +545,10 @@ void Player::updateFeet() {
void Player::initSounds() {
for (int i = 0; i < 24; ++i) {
std::string sound_file = "jump" + std::to_string(i + 1) + ".wav";
jumping_sound_[i] = Resource::get()->getSound(sound_file);
jumping_sound_[i] = Resource::Cache::get()->getSound(sound_file);
if (i >= 10) { // i+1 >= 11
falling_sound_[i - 10] = Resource::get()->getSound(sound_file);
falling_sound_[i - 10] = Resource::Cache::get()->getSound(sound_file);
}
}
}
@@ -649,7 +649,7 @@ void Player::applySpawnValues(const SpawnData& spawn) {
// Inicializa el sprite del jugador
void Player::initSprite(const std::string& animations_path) {
auto animations = Resource::get()->getAnimations(animations_path);
auto animations = Resource::Cache::get()->getAnimations(animations_path);
sprite_ = std::make_unique<SurfaceAnimatedSprite>(animations);
sprite_->setWidth(WIDTH);
sprite_->setHeight(HEIGHT);