renombrades les clases SSprite a SurfaceSprite

This commit is contained in:
2025-10-26 14:56:56 +01:00
parent fdea094e26
commit 342177a751
34 changed files with 225 additions and 221 deletions

View File

@@ -9,7 +9,7 @@
// Constructor
Enemy::Enemy(const EnemyData& enemy)
: sprite_(std::make_shared<SAnimatedSprite>(Resource::get()->getSurface(enemy.surface_path), Resource::get()->getAnimations(enemy.animation_path))),
: sprite_(std::make_shared<SurfaceAnimatedSprite>(Resource::get()->getSurface(enemy.surface_path), Resource::get()->getAnimations(enemy.animation_path))),
color_string_(enemy.color),
x1_(enemy.x1),
x2_(enemy.x2),

View File

@@ -2,9 +2,9 @@
#include <SDL3/SDL.h>
#include <memory> // Para shared_ptr
#include <string> // Para string
class SAnimatedSprite; // lines 7-7
#include <memory> // Para shared_ptr
#include <string> // Para string
class SurfaceAnimatedSprite; // lines 7-7
// Estructura para pasar los datos de un enemigo
struct EnemyData {
@@ -29,7 +29,7 @@ struct EnemyData {
class Enemy {
private:
// Objetos y punteros
std::shared_ptr<SAnimatedSprite> sprite_; // Sprite del enemigo
std::shared_ptr<SurfaceAnimatedSprite> sprite_; // Sprite del enemigo
// Variables
Uint8 color_; // Color del enemigo

View File

@@ -5,7 +5,7 @@
// Constructor
Item::Item(ItemData item)
: sprite_(std::make_shared<SSprite>(Resource::get()->getSurface(item.tile_set_file), item.x, item.y, ITEM_SIZE_, ITEM_SIZE_)),
: sprite_(std::make_shared<SurfaceSprite>(Resource::get()->getSurface(item.tile_set_file), item.x, item.y, ITEM_SIZE_, ITEM_SIZE_)),
change_color_speed(4) {
// Inicia variables
sprite_->setClip((item.tile % 10) * ITEM_SIZE_, (item.tile / 10) * ITEM_SIZE_, ITEM_SIZE_, ITEM_SIZE_);

View File

@@ -5,7 +5,7 @@
#include <memory> // Para shared_ptr
#include <string> // Para string
#include <vector> // Para vector
class SSprite;
class SurfaceSprite;
struct ItemData {
std::string tile_set_file; // Ruta al fichero con los gráficos del item
@@ -32,7 +32,7 @@ class Item {
static constexpr float ITEM_SIZE_ = 8;
// Objetos y punteros
std::shared_ptr<SSprite> sprite_; // SSprite del objeto
std::shared_ptr<SurfaceSprite> sprite_; // SSprite del objeto
// Variables
std::vector<Uint8> color_; // Vector con los colores del objeto

View File

@@ -9,8 +9,8 @@
#include "core/resources/resource.hpp" // Para Resource
#include "core/system/debug.hpp" // Para Debug
#include "external/jail_audio.h" // Para JA_PlaySound
#include "game/options.hpp" // Para Cheat, Options, options
#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
// Constructor
@@ -621,7 +621,7 @@ void Player::initSprite(const std::string& surface_path, const std::string& anim
auto surface = Resource::get()->getSurface(surface_path);
auto animations = Resource::get()->getAnimations(animations_path);
sprite_ = std::make_shared<SAnimatedSprite>(surface, animations);
sprite_ = std::make_shared<SurfaceAnimatedSprite>(surface, animations);
sprite_->setWidth(WIDTH_);
sprite_->setHeight(HEIGHT_);
sprite_->setCurrentAnimation("walk");

View File

@@ -71,8 +71,8 @@ class Player {
static constexpr float MAX_VY_ = 1.2f; // Velocidad máxima que puede alcanzar al desplazarse en vertical
// Objetos y punteros
std::shared_ptr<Room> room_; // Objeto encargado de gestionar cada habitación del juego
std::shared_ptr<SAnimatedSprite> sprite_; // Sprite del jugador
std::shared_ptr<Room> room_; // Objeto encargado de gestionar cada habitación del juego
std::shared_ptr<SurfaceAnimatedSprite> sprite_; // Sprite del jugador
// Variables
float x_; // Posición del jugador en el eje X