This commit is contained in:
2025-10-27 18:35:53 +01:00
parent b1dca32a5b
commit 3179a08dac
63 changed files with 686 additions and 693 deletions

View File

@@ -4,6 +4,7 @@
#include <memory> // Para shared_ptr, __shared_ptr_access
#include <string> // Para string
#include <utility>
#include <vector> // Para vector
#include "core/rendering/surface_animated_sprite.hpp" // Para SAnimatedSprite
@@ -57,9 +58,9 @@ struct PlayerData {
// Constructor
PlayerData(PlayerSpawn spawn, std::string texture_path, std::string animations_path, std::shared_ptr<Room> room)
: spawn(spawn),
texture_path(texture_path),
animations_path(animations_path),
room(room) {}
texture_path(std::move(std::move(texture_path))),
animations_path(std::move(std::move(animations_path))),
room(std::move(std::move(room))) {}
};
class Player {
@@ -145,16 +146,16 @@ class Player {
void playFallSound();
// Comprueba si el jugador tiene suelo debajo de los pies
bool isOnFloor();
auto isOnFloor() -> bool;
// Comprueba si el jugador esta sobre una superficie automática
bool isOnAutoSurface();
auto isOnAutoSurface() -> bool;
// Comprueba si el jugador está sobre una rampa hacia abajo
bool isOnDownSlope();
auto isOnDownSlope() -> bool;
// Comprueba que el jugador no toque ningun tile de los que matan
bool checkKillingTiles();
auto checkKillingTiles() -> bool;
// Actualiza los puntos de colisión
void updateColliderPoints();
@@ -196,31 +197,31 @@ public:
void update();
// Indica si el jugador esta en uno de los cuatro bordes de la pantalla
bool getOnBorder() const { return is_on_border_; }
[[nodiscard]] auto getOnBorder() const -> bool { return is_on_border_; }
// Indica en cual de los cuatro bordes se encuentra
RoomBorder getBorder() const { return border_; }
[[nodiscard]] auto getBorder() const -> RoomBorder { return border_; }
// Cambia al jugador de un borde al opuesto. Util para el cambio de pantalla
void switchBorders();
// Obtiene el rectangulo que delimita al jugador
SDL_FRect getRect() { return {x_, y_, WIDTH, HEIGHT}; }
auto getRect() -> SDL_FRect { return {x_, y_, WIDTH, HEIGHT}; }
// Obtiene el rectangulo de colision del jugador
SDL_FRect& getCollider() { return collider_box_; }
auto getCollider() -> SDL_FRect& { return collider_box_; }
// Obtiene el estado de reaparición del jugador
PlayerSpawn getSpawnParams() { return {x_, y_, vx_, vy_, jump_init_pos_, state_, sprite_->getFlip()}; }
auto getSpawnParams() -> PlayerSpawn { return {x_, y_, vx_, vy_, jump_init_pos_, state_, sprite_->getFlip()}; }
// Establece el color del jugador
void setColor();
// Establece la habitación en la que se encuentra el jugador
void setRoom(std::shared_ptr<Room> room) { room_ = room; }
void setRoom(std::shared_ptr<Room> room) { room_ = std::move(room); }
// Comprueba si el jugador esta vivo
bool isAlive() const { return is_alive_; }
[[nodiscard]] auto isAlive() const -> bool { return is_alive_; }
// Pone el jugador en modo pausa
void setPaused(bool value) { is_paused_ = value; }