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

@@ -1,5 +1,3 @@
#include "game/scene_manager.hpp" // Para SceneManager
#include "game/scenes/credits.hpp"
#include <SDL3/SDL.h>
@@ -12,14 +10,15 @@
#include "core/rendering/surface_animated_sprite.hpp" // Para SAnimatedSprite
#include "core/rendering/text.hpp" // Para Text, TEXT_CENTER, TEXT_COLOR
#include "core/resources/resource.hpp" // Para Resource
#include "game/options.hpp" // Para Options, options, OptionsGame, Sectio...
#include "game/options.hpp" // Para Options, options, OptionsGame, Sectio...
#include "game/scene_manager.hpp" // Para SceneManager
#include "utils/defines.hpp" // Para GAME_SPEED, PLAY_AREA_CENTER_X, PLAY_...
#include "utils/global_events.hpp" // Para check
#include "utils/utils.hpp" // Para PaletteColor
// Constructor
Credits::Credits()
: shining_sprite_(std::make_shared<SAnimatedSprite>(Resource::get()->getSurface("shine.gif"), Resource::get()->getAnimations("shine.ani"))) {
: shining_sprite_(std::make_shared<SurfaceAnimatedSprite>(Resource::get()->getSurface("shine.gif"), Resource::get()->getAnimations("shine.ani"))) {
// Inicializa variables
SceneManager::current = SceneManager::Scene::CREDITS;
SceneManager::options = SceneManager::Options::NONE;

View File

@@ -2,10 +2,10 @@
#include <SDL3/SDL.h>
#include <memory> // Para shared_ptr
#include <string> // Para string
#include <vector> // Para vector
class SAnimatedSprite; // lines 11-11
#include <memory> // Para shared_ptr
#include <string> // Para string
#include <vector> // Para vector
class SurfaceAnimatedSprite; // lines 11-11
class Surface;
class Credits {
@@ -16,9 +16,9 @@ class Credits {
};
// Objetos y punteros
std::shared_ptr<Surface> text_surface_; // Textura para dibujar el texto
std::shared_ptr<Surface> cover_surface_; // Textura para cubrir el texto
std::shared_ptr<SAnimatedSprite> shining_sprite_; // Sprite para el brillo del corazón
std::shared_ptr<Surface> text_surface_; // Textura para dibujar el texto
std::shared_ptr<Surface> cover_surface_; // Textura para cubrir el texto
std::shared_ptr<SurfaceAnimatedSprite> shining_sprite_; // Sprite para el brillo del corazón
// Variables
int counter_ = 0; // Contador

View File

@@ -1,5 +1,3 @@
#include "game/scene_manager.hpp" // Para SceneManager
#include "game/scenes/ending.hpp"
#include <SDL3/SDL.h>
@@ -13,7 +11,8 @@
#include "core/rendering/text.hpp" // Para Text, TEXT_STROKE
#include "core/resources/resource.hpp" // Para Resource
#include "external/jail_audio.h" // Para JA_SetVolume, JA_PlayMusic, JA_StopMusic
#include "game/options.hpp" // Para Options, options, OptionsGame, SectionS...
#include "game/options.hpp" // Para Options, options, OptionsGame, SectionS...
#include "game/scene_manager.hpp" // Para SceneManager
#include "utils/defines.hpp" // Para GAME_SPEED
#include "utils/global_events.hpp" // Para check
#include "utils/utils.hpp" // Para PaletteColor
@@ -168,7 +167,7 @@ void Ending::iniTexts() {
text->writeDX(TEXT_STROKE, 2, 2, txt.caption, 1, text_color, 2, shadow_color);
// Crea el sprite
st.image_sprite = std::make_shared<SSprite>(st.image_surface, 0, 0, st.image_surface->getWidth(), st.image_surface->getHeight());
st.image_sprite = std::make_shared<SurfaceSprite>(st.image_surface, 0, 0, st.image_surface->getWidth(), st.image_surface->getHeight());
st.image_sprite->setPosition((Options::game.width - st.image_surface->getWidth()) / 2, txt.pos);
// Crea la cover_surface
@@ -196,7 +195,7 @@ void Ending::iniTexts() {
surface->fillRect(&rect, color);
// Crea el sprite
st.cover_sprite = std::make_shared<SSprite>(st.cover_surface, 0, 0, st.cover_surface->getWidth(), st.cover_surface->getHeight() - 8);
st.cover_sprite = std::make_shared<SurfaceSprite>(st.cover_surface, 0, 0, st.cover_surface->getWidth(), st.cover_surface->getHeight() - 8);
st.cover_sprite->setPosition((Options::game.width - st.cover_surface->getWidth()) / 2, txt.pos);
st.cover_sprite->setClip(0, 8, st.cover_surface->getWidth(), st.cover_surface->getHeight());
@@ -233,7 +232,7 @@ void Ending::iniPics() {
const float HEIGHT = sp.image_surface->getHeight();
// Crea el sprite
sp.image_sprite = std::make_shared<SSprite>(sp.image_surface, 0, 0, WIDTH, HEIGHT);
sp.image_sprite = std::make_shared<SurfaceSprite>(sp.image_surface, 0, 0, WIDTH, HEIGHT);
sp.image_sprite->setPosition((Options::game.width - WIDTH) / 2, pic.pos);
// Crea la cover_surface
@@ -262,7 +261,7 @@ void Ending::iniPics() {
surface->fillRect(&rect, color);
// Crea el sprite
sp.cover_sprite = std::make_shared<SSprite>(sp.cover_surface, 0, 0, sp.cover_surface->getWidth(), sp.cover_surface->getHeight() - 8);
sp.cover_sprite = std::make_shared<SurfaceSprite>(sp.cover_surface, 0, 0, sp.cover_surface->getWidth(), sp.cover_surface->getHeight() - 8);
sp.cover_sprite->setPosition((Options::game.width - sp.cover_surface->getWidth()) / 2, pic.pos);
sp.cover_sprite->setClip(0, 8, sp.cover_surface->getWidth(), sp.cover_surface->getHeight());

View File

@@ -2,23 +2,23 @@
#include <SDL3/SDL.h>
#include <memory> // Para shared_ptr
#include <string> // Para string
#include <vector> // Para vector
class SSprite; // lines 8-8
class Surface; // lines 9-9
#include <memory> // Para shared_ptr
#include <string> // Para string
#include <vector> // Para vector
class SurfaceSprite; // lines 8-8
class Surface; // lines 9-9
class Ending {
private:
// Estructuras
struct EndingSurface // Estructura con dos texturas y sprites, uno para mostrar y el otro hace de cortinilla
{
std::shared_ptr<Surface> image_surface; // Surface a mostrar
std::shared_ptr<SSprite> image_sprite; // SSprite para mostrar la textura
std::shared_ptr<Surface> cover_surface; // Surface que cubre a la otra textura
std::shared_ptr<SSprite> cover_sprite; // SSprite para mostrar la textura que cubre a la otra textura
int cover_clip_desp; // Desplazamiento del spriteClip de la textura de cobertura
int cover_clip_height; // Altura del spriteClip de la textura de cobertura
std::shared_ptr<Surface> image_surface; // Surface a mostrar
std::shared_ptr<SurfaceSprite> image_sprite; // SSprite para mostrar la textura
std::shared_ptr<Surface> cover_surface; // Surface que cubre a la otra textura
std::shared_ptr<SurfaceSprite> cover_sprite; // SSprite para mostrar la textura que cubre a la otra textura
int cover_clip_desp; // Desplazamiento del spriteClip de la textura de cobertura
int cover_clip_height; // Altura del spriteClip de la textura de cobertura
};
struct TextAndPosition // Estructura con un texto y su posición en el eje Y

View File

@@ -12,7 +12,7 @@
#include "core/rendering/text.hpp" // Para Text
#include "core/resources/resource.hpp" // Para Resource
#include "external/jail_audio.h" // Para JA_SetVolume, JA_PlayMusic, JA_StopMusic
#include "game/options.hpp" // Para Options, options, OptionsGame, Sectio...
#include "game/options.hpp" // Para Options, options, OptionsGame, Sectio...
#include "game/scene_manager.hpp" // Para SceneManager
#include "utils/defines.hpp" // Para GAMECANVAS_CENTER_X, GAMECANVAS_CENTER_Y
#include "utils/global_events.hpp" // Para check
@@ -275,7 +275,7 @@ void Ending2::loadSprites() {
// Carga los sprites
for (const auto& file : sprite_list_) {
sprites_.emplace_back(std::make_shared<SAnimatedSprite>(Resource::get()->getSurface(file + ".gif"), Resource::get()->getAnimations(file + ".ani")));
sprites_.emplace_back(std::make_shared<SurfaceAnimatedSprite>(Resource::get()->getSurface(file + ".gif"), Resource::get()->getAnimations(file + ".ani")));
sprite_max_width_ = std::max(sprites_.back()->getWidth(), sprite_max_width_);
sprite_max_height_ = std::max(sprites_.back()->getHeight(), sprite_max_height_);
}
@@ -395,7 +395,7 @@ void Ending2::createSpriteTexts() {
// Crea el sprite
SDL_FRect pos = {X, Y, W, H};
sprite_texts_.emplace_back(std::make_shared<SMovingSprite>(surface, pos));
sprite_texts_.emplace_back(std::make_shared<SurfaceMovingSprite>(surface, pos));
sprite_texts_.back()->setVelY(SPRITE_DESP_SPEED_);
Screen::get()->setRendererSurface(previuos_renderer);
}
@@ -426,7 +426,7 @@ void Ending2::createTexts() {
// Crea el sprite
SDL_FRect pos = {X + DX, Y, W, H};
texts_.emplace_back(std::make_shared<SMovingSprite>(surface, pos));
texts_.emplace_back(std::make_shared<SurfaceMovingSprite>(surface, pos));
texts_.back()->setVelY(SPRITE_DESP_SPEED_);
Screen::get()->setRendererSurface(previuos_renderer);
}
@@ -455,7 +455,7 @@ void Ending2::createTexts() {
// Crea el sprite
SDL_FRect pos = {X + DX, Y, W, H};
texts_.emplace_back(std::make_shared<SMovingSprite>(surface, pos));
texts_.emplace_back(std::make_shared<SurfaceMovingSprite>(surface, pos));
texts_.back()->setVelY(SPRITE_DESP_SPEED_);
Screen::get()->setRendererSurface(previuos_renderer);
}

View File

@@ -7,8 +7,8 @@
#include <vector> // Para vector
#include "utils/defines.hpp" // Para GAMECANVAS_WIDTH, GAMECANVAS_FIRST_QUAR...
class SAnimatedSprite; // lines 9-9
class SMovingSprite; // lines 10-10
class SurfaceAnimatedSprite; // lines 9-9
class SurfaceMovingSprite; // lines 10-10
class Ending2 {
private:
@@ -62,9 +62,9 @@ class Ending2 {
static constexpr int STATE_FADE_DURATION_ = 5000;
// Objetos y punteros
std::vector<std::shared_ptr<SAnimatedSprite>> sprites_; // Vector con todos los sprites a dibujar
std::vector<std::shared_ptr<SMovingSprite>> sprite_texts_; // Vector con los sprites de texto de los sprites
std::vector<std::shared_ptr<SMovingSprite>> texts_; // Vector con los sprites de texto
std::vector<std::shared_ptr<SurfaceAnimatedSprite>> sprites_; // Vector con todos los sprites a dibujar
std::vector<std::shared_ptr<SurfaceMovingSprite>> sprite_texts_; // Vector con los sprites de texto de los sprites
std::vector<std::shared_ptr<SurfaceMovingSprite>> texts_; // Vector con los sprites de texto
// Variables
Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa

View File

@@ -1,5 +1,3 @@
#include "game/scene_manager.hpp" // Para SceneManager
#include "game/scenes/game_over.hpp"
#include <SDL3/SDL.h>
@@ -13,15 +11,16 @@
#include "core/rendering/text.hpp" // Para TEXT_CENTER, TEXT_COLOR, Text
#include "core/resources/resource.hpp" // Para Resource
#include "external/jail_audio.h" // Para JA_PlayMusic
#include "game/options.hpp" // Para Options, options, OptionsStats, Secti...
#include "game/options.hpp" // Para Options, options, OptionsStats, Secti...
#include "game/scene_manager.hpp" // Para SceneManager
#include "utils/defines.hpp" // Para GAMECANVAS_CENTER_X, GAME_SPEED
#include "utils/global_events.hpp" // Para check
#include "utils/utils.hpp" // Para PaletteColor, stringToColor
// Constructor
GameOver::GameOver()
: player_sprite_(std::make_shared<SAnimatedSprite>(Resource::get()->getSurface("player_game_over.gif"), Resource::get()->getAnimations("player_game_over.ani"))),
tv_sprite_(std::make_shared<SAnimatedSprite>(Resource::get()->getSurface("tv.gif"), Resource::get()->getAnimations("tv.ani"))),
: player_sprite_(std::make_shared<SurfaceAnimatedSprite>(Resource::get()->getSurface("player_game_over.gif"), Resource::get()->getAnimations("player_game_over.ani"))),
tv_sprite_(std::make_shared<SurfaceAnimatedSprite>(Resource::get()->getSurface("tv.gif"), Resource::get()->getAnimations("tv.ani"))),
pre_counter_(0),
counter_(0),
ticks_(0) {

View File

@@ -2,9 +2,9 @@
#include <SDL3/SDL.h>
#include <memory> // Para shared_ptr
#include <vector> // Para vector
class SAnimatedSprite; // lines 7-7
#include <memory> // Para shared_ptr
#include <vector> // Para vector
class SurfaceAnimatedSprite; // lines 7-7
class GameOver {
private:
@@ -14,8 +14,8 @@ class GameOver {
static constexpr int COUNTER_FADE_LENGHT_ = 20; // Contador: duración del fade
// Objetos y punteros
std::shared_ptr<SAnimatedSprite> player_sprite_; // Sprite con el jugador
std::shared_ptr<SAnimatedSprite> tv_sprite_; // Sprite con el televisor
std::shared_ptr<SurfaceAnimatedSprite> player_sprite_; // Sprite con el jugador
std::shared_ptr<SurfaceAnimatedSprite> tv_sprite_; // Sprite con el televisor
// Variables
int pre_counter_ = 0; // Contador previo

View File

@@ -1,5 +1,3 @@
#include "game/scene_manager.hpp" // Para SceneManager
#include "game/scenes/loading_screen.hpp"
#include <SDL3/SDL.h>
@@ -11,7 +9,8 @@
#include "core/rendering/surface_sprite.hpp" // Para SSprite
#include "core/resources/resource.hpp" // Para Resource
#include "external/jail_audio.h" // Para JA_PlayMusic, JA_SetVolume, JA_StopMusic
#include "game/options.hpp" // Para Options, options, SectionState, Options...
#include "game/options.hpp" // Para Options, options, SectionState, Options...
#include "game/scene_manager.hpp" // Para SceneManager
#include "utils/defines.hpp" // Para GAME_SPEED
#include "utils/global_events.hpp" // Para check
#include "utils/utils.hpp" // Para stringToColor, PaletteColor
@@ -20,8 +19,8 @@
LoadingScreen::LoadingScreen()
: mono_loading_screen_surface_(Resource::get()->getSurface("loading_screen_bn.gif")),
color_loading_screen_surface_(Resource::get()->getSurface("loading_screen_color.gif")),
mono_loading_screen_sprite_(std::make_shared<SSprite>(mono_loading_screen_surface_, 0, 0, mono_loading_screen_surface_->getWidth(), mono_loading_screen_surface_->getHeight())),
color_loading_screen_sprite_(std::make_shared<SSprite>(color_loading_screen_surface_, 0, 0, color_loading_screen_surface_->getWidth(), color_loading_screen_surface_->getHeight())),
mono_loading_screen_sprite_(std::make_shared<SurfaceSprite>(mono_loading_screen_surface_, 0, 0, mono_loading_screen_surface_->getWidth(), mono_loading_screen_surface_->getHeight())),
color_loading_screen_sprite_(std::make_shared<SurfaceSprite>(color_loading_screen_surface_, 0, 0, color_loading_screen_surface_->getWidth(), color_loading_screen_surface_->getHeight())),
screen_surface_(std::make_shared<Surface>(Options::game.width, Options::game.height)) {
// Configura la superficie donde se van a pintar los sprites
screen_surface_->clear(static_cast<Uint8>(PaletteColor::WHITE));

View File

@@ -2,18 +2,18 @@
#include <SDL3/SDL.h>
#include <memory> // Para shared_ptr
class SSprite; // lines 7-7
class Surface; // lines 8-8
#include <memory> // Para shared_ptr
class SurfaceSprite; // lines 7-7
class Surface; // lines 8-8
class LoadingScreen {
private:
// Objetos y punteros
std::shared_ptr<Surface> mono_loading_screen_surface_; // Surface con la pantalla de carga en blanco y negro
std::shared_ptr<Surface> color_loading_screen_surface_; // Surface con la pantalla de carga en color
std::shared_ptr<SSprite> mono_loading_screen_sprite_; // SSprite para manejar la textura loadingScreenTexture1
std::shared_ptr<SSprite> color_loading_screen_sprite_; // SSprite para manejar la textura loadingScreenTexture2
std::shared_ptr<Surface> screen_surface_; // Surface para dibujar la pantalla de carga
std::shared_ptr<Surface> mono_loading_screen_surface_; // Surface con la pantalla de carga en blanco y negro
std::shared_ptr<Surface> color_loading_screen_surface_; // Surface con la pantalla de carga en color
std::shared_ptr<SurfaceSprite> mono_loading_screen_sprite_; // SSprite para manejar la textura loadingScreenTexture1
std::shared_ptr<SurfaceSprite> color_loading_screen_sprite_; // SSprite para manejar la textura loadingScreenTexture2
std::shared_ptr<Surface> screen_surface_; // Surface para dibujar la pantalla de carga
// Variables
int pre_counter_ = 0; // Contador previo para realizar una pausa inicial

View File

@@ -7,7 +7,7 @@
#include "core/rendering/surface.hpp" // Para Surface
#include "core/rendering/surface_sprite.hpp" // Para SSprite
#include "core/resources/resource.hpp" // Para Resource
#include "game/options.hpp" // Para Options, SectionState, options, Section
#include "game/options.hpp" // Para Options, SectionState, options, Section
#include "game/scene_manager.hpp" // Para SceneManager
#include "utils/defines.hpp" // Para GAME_SPEED
#include "utils/global_events.hpp" // Para check
@@ -17,35 +17,24 @@
Logo::Logo()
: jailgames_surface_(Resource::get()->getSurface("jailgames.gif")),
since_1998_surface_(Resource::get()->getSurface("since_1998.gif")),
since_1998_sprite_(std::make_shared<SSprite>(since_1998_surface_, (256 - since_1998_surface_->getWidth()) / 2, 83 + jailgames_surface_->getHeight() + 5, since_1998_surface_->getWidth(), since_1998_surface_->getHeight())) {
since_1998_sprite_(std::make_shared<SurfaceSprite>(since_1998_surface_, (256 - since_1998_surface_->getWidth()) / 2, 83 + jailgames_surface_->getHeight() + 5, since_1998_surface_->getWidth(), since_1998_surface_->getHeight())) {
// Configura variables
since_1998_sprite_->setClip(0, 0, since_1998_surface_->getWidth(), since_1998_surface_->getHeight());
since_1998_color_ = static_cast<Uint8>(PaletteColor::BLACK);
jailgames_color_ = static_cast<Uint8>(PaletteColor::BRIGHT_WHITE);
// Inicializa variables
SceneManager::current = SceneManager::Scene::LOGO;
// Crea los sprites de cada linea
for (int i = 0; i < jailgames_surface_->getHeight(); ++i) {
jailgames_sprite_.push_back(std::make_shared<SSprite>(jailgames_surface_, 0, i, jailgames_surface_->getWidth(), 1));
jailgames_sprite_.push_back(std::make_shared<SurfaceSprite>(jailgames_surface_, 0, i, jailgames_surface_->getWidth(), 1));
jailgames_sprite_.back()->setClip(0, i, jailgames_surface_->getWidth(), 1);
jailgames_sprite_.at(i)->setX((i % 2 == 0) ? (256 + (i * 3)) : (-181 - (i * 3)));
jailgames_sprite_.at(i)->setY(83 + i);
}
// Inicializa variables
SceneManager::current = SceneManager::Scene::LOGO;
// Inicializa el vector de colores
const std::vector<Uint8> COLORS = {
static_cast<Uint8>(PaletteColor::BLACK),
static_cast<Uint8>(PaletteColor::BLUE),
static_cast<Uint8>(PaletteColor::RED),
static_cast<Uint8>(PaletteColor::MAGENTA),
static_cast<Uint8>(PaletteColor::GREEN),
static_cast<Uint8>(PaletteColor::CYAN),
static_cast<Uint8>(PaletteColor::YELLOW),
static_cast<Uint8>(PaletteColor::BRIGHT_WHITE)};
for (const auto& color : COLORS) {
color_.push_back(color);
}
initColors(); // Inicializa el vector de colores
// Cambia el color del borde
Screen::get()->setBorderColor(static_cast<Uint8>(PaletteColor::BLACK));
@@ -220,3 +209,20 @@ void Logo::endSection() {
break;
}
}
// Inicializa el vector de colores
void Logo::initColors() {
// Inicializa el vector de colores
const std::vector<Uint8> COLORS = {
static_cast<Uint8>(PaletteColor::BLACK),
static_cast<Uint8>(PaletteColor::BLUE),
static_cast<Uint8>(PaletteColor::RED),
static_cast<Uint8>(PaletteColor::MAGENTA),
static_cast<Uint8>(PaletteColor::GREEN),
static_cast<Uint8>(PaletteColor::CYAN),
static_cast<Uint8>(PaletteColor::YELLOW),
static_cast<Uint8>(PaletteColor::BRIGHT_WHITE)};
for (const auto& color : COLORS) {
color_.push_back(color);
}
}

View File

@@ -2,10 +2,10 @@
#include <SDL3/SDL.h>
#include <memory> // Para shared_ptr
#include <vector> // Para vector
class SSprite; // lines 7-7
class Surface; // lines 8-8
#include <memory> // Para shared_ptr
#include <vector> // Para vector
class SurfaceSprite; // lines 7-7
class Surface; // lines 8-8
class Logo {
private:
@@ -15,12 +15,12 @@ class Logo {
static constexpr int POST_LOGO_ = 20; // Tiempo que dura el logo con el fade al maximo
// Objetos y punteros
std::shared_ptr<Surface> jailgames_surface_; // Textura con los graficos "JAILGAMES"
std::shared_ptr<Surface> since_1998_surface_; // Textura con los graficos "Since 1998"
std::vector<std::shared_ptr<SSprite>> jailgames_sprite_; // Vector con los sprites de cada linea que forman el bitmap JAILGAMES
std::shared_ptr<SSprite> since_1998_sprite_; // SSprite para manejar la textura2
Uint8 jailgames_color_ = 0; // Color para el sprite de "JAILGAMES"
Uint8 since_1998_color_ = 0; // Color para el sprite de "Since 1998"
std::shared_ptr<Surface> jailgames_surface_; // Textura con los graficos "JAILGAMES"
std::shared_ptr<Surface> since_1998_surface_; // Textura con los graficos "Since 1998"
std::vector<std::shared_ptr<SurfaceSprite>> jailgames_sprite_; // Vector con los sprites de cada linea que forman el bitmap JAILGAMES
std::shared_ptr<SurfaceSprite> since_1998_sprite_; // SSprite para manejar la textura2
Uint8 jailgames_color_ = 0; // Color para el sprite de "JAILGAMES"
Uint8 since_1998_color_ = 0; // Color para el sprite de "Since 1998"
// Variables
std::vector<Uint8> color_; // Vector con los colores para el fade
@@ -48,6 +48,9 @@ class Logo {
// Termina la sección
void endSection();
// Inicializa el vector de colores
void initColors();
public:
// Constructor
Logo();

View File

@@ -1,5 +1,3 @@
#include "game/scene_manager.hpp" // Para SceneManager
#include "game/scenes/title.hpp"
#include <SDL3/SDL.h>
@@ -14,7 +12,8 @@
#include "core/rendering/text.hpp" // Para Text, TEXT_CENTER, TEXT_COLOR
#include "core/resources/resource.hpp" // Para Resource
#include "game/gameplay/cheevos.hpp" // Para Cheevos, Achievement
#include "game/options.hpp" // Para Options, options, SectionState, Section
#include "game/options.hpp" // Para Options, options, SectionState, Section
#include "game/scene_manager.hpp" // Para SceneManager
#include "utils/defines.hpp" // Para PLAY_AREA_CENTER_X, GAMECANVAS_WIDTH
#include "utils/global_events.hpp" // Para check
#include "utils/utils.hpp" // Para stringToColor, PaletteColor, playMusic
@@ -22,9 +21,9 @@
// Constructor
Title::Title()
: title_logo_surface_(Resource::get()->getSurface("title_logo.gif")),
title_logo_sprite_(std::make_shared<SSprite>(title_logo_surface_, 29, 9, title_logo_surface_->getWidth(), title_logo_surface_->getHeight())),
title_logo_sprite_(std::make_shared<SurfaceSprite>(title_logo_surface_, 29, 9, title_logo_surface_->getWidth(), title_logo_surface_->getHeight())),
loading_screen_surface_(Resource::get()->getSurface("loading_screen_color.gif")),
loading_screen_sprite_(std::make_shared<SSprite>(loading_screen_surface_, 0, 0, loading_screen_surface_->getWidth(), loading_screen_surface_->getHeight())),
loading_screen_sprite_(std::make_shared<SurfaceSprite>(loading_screen_surface_, 0, 0, loading_screen_surface_->getWidth(), loading_screen_surface_->getHeight())),
bg_surface_(std::make_shared<Surface>(Options::game.width, Options::game.height)) {
// Inicializa variables
state_ = SceneManager::options == SceneManager::Options::TITLE_WITH_LOADING_SCREEN ? TitleState::SHOW_LOADING_SCREEN : TitleState::SHOW_MENU;
@@ -321,7 +320,7 @@ void Title::createCheevosTexture() {
Screen::get()->setRendererSurface(previuos_renderer);
// Crea el sprite para el listado de logros
cheevos_sprite_ = std::make_shared<SSprite>(cheevos_surface_, (GAMECANVAS_WIDTH - cheevos_surface_->getWidth()) / 2, CHEEVOS_TEXTURE_POS_Y, cheevos_surface_->getWidth(), cheevos_surface_->getHeight());
cheevos_sprite_ = std::make_shared<SurfaceSprite>(cheevos_surface_, (GAMECANVAS_WIDTH - cheevos_surface_->getWidth()) / 2, CHEEVOS_TEXTURE_POS_Y, cheevos_surface_->getWidth(), cheevos_surface_->getHeight());
cheevos_surface_view_ = {0, 0, cheevos_surface_->getWidth(), CHEEVOS_TEXTURE_VIEW_HEIGHT};
cheevos_sprite_->setClip(cheevos_surface_view_);
}

View File

@@ -2,11 +2,11 @@
#include <SDL3/SDL.h>
#include <memory> // Para shared_ptr
#include <string> // Para string
#include <vector> // Para vector
class SSprite; // lines 9-9
class Surface; // lines 10-10
#include <memory> // Para shared_ptr
#include <string> // Para string
#include <vector> // Para vector
class SurfaceSprite; // lines 9-9
class Surface; // lines 10-10
class Title {
private:
@@ -23,13 +23,13 @@ class Title {
};
// Objetos y punteros
std::shared_ptr<Surface> title_logo_surface_; // Textura con los graficos
std::shared_ptr<SSprite> title_logo_sprite_; // SSprite para manejar la surface
std::shared_ptr<Surface> loading_screen_surface_; // Surface con los gráficos de la pantalla de carga
std::shared_ptr<SSprite> loading_screen_sprite_; // SSprite con los gráficos de la pantalla de carga
std::shared_ptr<Surface> bg_surface_; // Textura para dibujar el fondo de la pantalla
std::shared_ptr<Surface> cheevos_surface_; // Textura con la lista de logros
std::shared_ptr<SSprite> cheevos_sprite_; // SSprite para manejar la surface con la lista de logros
std::shared_ptr<Surface> title_logo_surface_; // Textura con los graficos
std::shared_ptr<SurfaceSprite> title_logo_sprite_; // SSprite para manejar la surface
std::shared_ptr<Surface> loading_screen_surface_; // Surface con los gráficos de la pantalla de carga
std::shared_ptr<SurfaceSprite> loading_screen_sprite_; // SSprite con los gráficos de la pantalla de carga
std::shared_ptr<Surface> bg_surface_; // Textura para dibujar el fondo de la pantalla
std::shared_ptr<Surface> cheevos_surface_; // Textura con la lista de logros
std::shared_ptr<SurfaceSprite> cheevos_sprite_; // SSprite para manejar la surface con la lista de logros
// Variables
int counter_ = 0; // Contador