Transició a surface acabada. Ja compila

This commit is contained in:
2025-03-04 12:30:19 +01:00
parent c4033e3663
commit 05f91b2a94
31 changed files with 376 additions and 1078 deletions

View File

@@ -3,7 +3,7 @@
#include <stdlib.h> // for rand
#include <algorithm> // for max, min
#include <cmath> // for ceil, abs
#include "s_animated_sprite.h" // for AnimatedSprite
#include "s_animated_sprite.h" // for SAnimatedSprite
#include "debug.h" // for Debug
#include "defines.h" // for BORDER_BOTTOM, BORDER_LEFT, BORDER_RIGHT
#include "input.h" // for Input, InputAction
@@ -43,8 +43,7 @@ Player::Player(const PlayerData &player)
// Pinta el jugador en pantalla
void Player::render()
{
sprite_->getTexture()->setColor(color_.r, color_.g, color_.b);
sprite_->render();
sprite_->render(1, color_);
#ifdef DEBUG
renderDebugInfo();
@@ -718,7 +717,7 @@ void Player::initSprite(const std::string &texture_path, const std::string &anim
auto texture = Resource::get()->getSurface(texture_path);
auto animations = Resource::get()->getAnimations(animations_path);
sprite_ = std::make_shared<AnimatedSprite>(texture, animations);
sprite_ = std::make_shared<SAnimatedSprite>(texture, animations);
sprite_->setWidth(WIDTH_);
sprite_->setHeight(HEIGHT_);
sprite_->setCurrentAnimation("walk");
@@ -728,6 +727,7 @@ void Player::initSprite(const std::string &texture_path, const std::string &anim
// Pinta la información de debug del jugador
void Player::renderDebugInfo()
{
/*
if (Debug::get()->getEnabled())
{
auto renderer = Screen::get()->getRenderer();
@@ -759,5 +759,6 @@ void Player::renderDebugInfo()
SDL_SetRenderDrawColor(renderer, rand() % 256, rand() % 256, rand() % 256, 255);
SDL_RenderDrawPoint(renderer, debug_point_.x, debug_point_.y);
}
*/
}
#endif