diff --git a/source/director.cpp b/source/director.cpp index ca00bf0..2849321 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -54,7 +54,7 @@ Director::Director(int argc, const char *argv[]) section::name = section::Name::GAME; section::options = section::Options::GAME_PLAY_1P; #elif DEBUG - section::name = section::Name::CREDITS; + section::name = section::Name::LOGO; #else // NORMAL GAME section::name = section::Name::LOGO; section::attract_mode = section::AttractMode::TITLE_TO_DEMO; diff --git a/source/game_logo.cpp b/source/game_logo.cpp index bcc7fb4..4f83307 100644 --- a/source/game_logo.cpp +++ b/source/game_logo.cpp @@ -90,6 +90,9 @@ void GameLogo::init() dust_left_sprite_->setPosY(y_); dust_left_sprite_->setWidth(16); dust_left_sprite_->setHeight(16); + + // Inicializa el bitmap de 'Arcade Edition' + arcade_edition_sprite_->setZoom(2.0f); } // Pinta la clase en pantalla diff --git a/source/sprite.cpp b/source/sprite.cpp index 4c4e748..7037b3a 100644 --- a/source/sprite.cpp +++ b/source/sprite.cpp @@ -19,31 +19,7 @@ Sprite::Sprite(std::shared_ptr texture) // Muestra el sprite por pantalla void Sprite::render() { - texture_->render(pos_.x, pos_.y, &sprite_clip_); -} - -// Obten el valor de la variable -int Sprite::getX() const -{ - return pos_.x; -} - -// Obten el valor de la variable -int Sprite::getY() const -{ - return pos_.y; -} - -// Obten el valor de la variable -int Sprite::getWidth() const -{ - return pos_.w; -} - -// Obten el valor de la variable -int Sprite::getHeight() const -{ - return pos_.h; + texture_->render(pos_.x, pos_.y, &sprite_clip_, zoom_, zoom_); } // Establece la posición del objeto @@ -60,84 +36,6 @@ void Sprite::setPosition(SDL_Point p) pos_.y = p.y; } -// Establece la posición del objeto -void Sprite::setPosition(SDL_Rect r) -{ - pos_ = r; -} - -// Establece el valor de la variable -void Sprite::setX(int x) -{ - pos_.x = x; -} - -// Establece el valor de la variable -void Sprite::setY(int y) -{ - pos_.y = y; -} - -// Establece el valor de la variable -void Sprite::setWidth(int w) -{ - pos_.w = w; -} - -// Establece el valor de la variable -void Sprite::setHeight(int h) -{ - pos_.h = h; -} - -// Obten el valor de la variable -SDL_Rect Sprite::getSpriteClip() const -{ - return sprite_clip_; -} - -// Establece el valor de la variable -void Sprite::setSpriteClip(SDL_Rect rect) -{ - sprite_clip_ = rect; -} - -// Establece el valor de la variable -void Sprite::setSpriteClip(int x, int y, int w, int h) -{ - sprite_clip_ = (SDL_Rect){x, y, w, h}; -} - -// Obten el valor de la variable -std::shared_ptr Sprite::getTexture() const -{ - return texture_; -} - -// Establece el valor de la variable -void Sprite::setTexture(std::shared_ptr texture) -{ - texture_ = texture; -} - -// Devuelve el rectangulo donde está el sprite -SDL_Rect Sprite::getPosition() const -{ - return pos_; -} - -// Incrementa el valor de la variable -void Sprite::incX(int value) -{ - pos_.x += value; -} - -// Incrementa el valor de la variable -void Sprite::incY(int value) -{ - pos_.y += value; -} - // Reinicia las variables a cero void Sprite::clear() { diff --git a/source/sprite.h b/source/sprite.h index d059437..f329951 100644 --- a/source/sprite.h +++ b/source/sprite.h @@ -12,6 +12,7 @@ protected: std::shared_ptr texture_; // Textura donde estan todos los dibujos del sprite SDL_Rect pos_; // Posición y tamaño donde dibujar el sprite SDL_Rect sprite_clip_; // Rectangulo de origen de la textura que se dibujará en pantalla + double zoom_ = 1.0f; // Zoom aplicado a la textura public: // Constructor @@ -28,40 +29,43 @@ public: // Reinicia las variables a cero virtual void clear(); - // Obten el valor de la variable - int getX() const; - int getY() const; - int getWidth() const; - int getHeight() const; + // Obtiene la posición y el tamaño + int getX() const { return pos_.x; } + int getY() const { return pos_.y; } + int getWidth() const { return pos_.w; } + int getHeight() const { return pos_.h; } // Devuelve el rectangulo donde está el sprite - SDL_Rect getPosition() const; + SDL_Rect getPosition() const { return pos_; } - // Establece el valor de la variable - void setX(int x); - void setY(int y); - void setWidth(int w); - void setHeight(int h); + // Establece la posición y el tamaño + void setX(int x) { pos_.x = x; } + void setY(int y) { pos_.y = y; } + void setWidth(int w) { pos_.w = w; } + void setHeight(int h) { pos_.h = h; } // Establece la posición del objeto void setPosition(int x, int y); void setPosition(SDL_Point p); - void setPosition(SDL_Rect r); + void setPosition(SDL_Rect r) { pos_ = r; } - // Incrementa el valor de la variable - void incX(int value); - void incY(int value); + // Establece el nivel de zoom + void setZoom(float zoom) { zoom_ = zoom; } - // Obten el valor de la variable - SDL_Rect getSpriteClip() const; + // Aumenta o disminuye la posición + void incX(int value) { pos_.x += value; } + void incY(int value) { pos_.y += value; } - // Establece el valor de la variable - void setSpriteClip(SDL_Rect rect); - void setSpriteClip(int x, int y, int w, int h); + // Obtiene el rectangulo que se dibuja de la textura + SDL_Rect getSpriteClip() const { return sprite_clip_; } - // Obten el valor de la variable - std::shared_ptr getTexture() const; + // Establece el rectangulo que se dibuja de la textura + void setSpriteClip(SDL_Rect rect) { sprite_clip_ = rect; } + void setSpriteClip(int x, int y, int w, int h) { sprite_clip_ = (SDL_Rect){x, y, w, h}; } - // Establece el valor de la variable - void setTexture(std::shared_ptr texture); + // Obtiene un puntero a la textura + std::shared_ptr getTexture() const { return texture_; } + + // Establece la textura a utilizar + void setTexture(std::shared_ptr texture) { texture_ = texture; } }; \ No newline at end of file