corregits mes includes

llevats els errors en texture
This commit is contained in:
2025-10-15 09:14:30 +02:00
parent 78c5333144
commit 7c102e42cc
63 changed files with 1122 additions and 1621 deletions

View File

@@ -1,12 +1,12 @@
#include "item.h"
#include "resource.h" // Para Resource
#include "s_sprite.h" // Para SSprite
#include "resource.h" // Para Resource
#include "sprite/surface_sprite.h" // Para SSprite
// 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_)),
change_color_speed(4)
{
change_color_speed(4) {
// Inicia variables
sprite_->setClip((item.tile % 10) * ITEM_SIZE_, (item.tile / 10) * ITEM_SIZE_, ITEM_SIZE_, ITEM_SIZE_);
collider_ = sprite_->getRect();
@@ -21,22 +21,19 @@ Item::Item(ItemData item)
}
// Pinta el objeto en pantalla
void Item::render()
{
void Item::render() {
const int INDEX = (counter_ / change_color_speed) % color_.size();
sprite_->render(1, color_.at(INDEX));
}
// Obtiene su ubicación
SDL_Point Item::getPos()
{
SDL_Point Item::getPos() {
const SDL_Point p = {sprite_->getX(), sprite_->getY()};
return p;
}
// Asigna los colores del objeto
void Item::setColors(Uint8 col1, Uint8 col2)
{
void Item::setColors(Uint8 col1, Uint8 col2) {
// Reinicializa el vector de colores
color_.clear();