Transició a surface: vaig per title.cpp

This commit is contained in:
2025-03-02 21:56:19 +01:00
parent db3a0d7263
commit 8f1d1df5d6
27 changed files with 416 additions and 490 deletions

View File

@@ -1,30 +1,30 @@
#include "game_over.h"
#include <SDL2/SDL_events.h> // for SDL_PollEvent, SDL_Event
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include <algorithm> // for min, max
#include <string> // for basic_string, operator+, to_string, cha...
#include "animated_sprite.h" // for AnimatedSprite
#include "defines.h" // for GAMECANVAS_CENTER_X, GAME_SPEED
#include "global_events.h" // for check
#include "global_inputs.h" // for check
#include "jail_audio.h" // for JA_PlayMusic
#include "options.h" // for Options, options, OptionsStats, Section...
#include "resource.h" // for Resource
#include "screen.h" // for Screen
#include "text.h" // for TEXT_CENTER, TEXT_COLOR, Text
#include "texture.h" // for Texture
#include <SDL2/SDL_events.h> // for SDL_PollEvent, SDL_Event
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include <algorithm> // for min, max
#include <string> // for basic_string, operator+, to_string, cha...
#include "s_animated_sprite.h" // for AnimatedSprite
#include "defines.h" // for GAMECANVAS_CENTER_X, GAME_SPEED
#include "global_events.h" // for check
#include "global_inputs.h" // for check
#include "jail_audio.h" // for JA_PlayMusic
#include "options.h" // for Options, options, OptionsStats, Section...
#include "resource.h" // for Resource
#include "screen.h" // for Screen
#include "text.h" // for TEXT_CENTER, TEXT_COLOR, Text
#include "surface.h" // for Texture
// Constructor
GameOver::GameOver()
: player_sprite_(std::make_shared<AnimatedSprite>(Resource::get()->getTexture("player_game_over.png"), Resource::get()->getAnimations("player_game_over.ani"))),
tv_sprite_(std::make_shared<AnimatedSprite>(Resource::get()->getTexture("tv.png"), Resource::get()->getAnimations("tv.ani"))),
: player_sprite_(std::make_shared<AnimatedSprite>(Resource::get()->getSurface("player_game_over.gif"), Resource::get()->getAnimations("player_game_over.ani"))),
tv_sprite_(std::make_shared<AnimatedSprite>(Resource::get()->getSurface("tv.gif"), Resource::get()->getAnimations("tv.ani"))),
pre_counter_(0),
counter_(0),
ticks_(0)
{
options.section.section = Section::GAME_OVER;
options.section.subsection = Subsection::NONE;
player_sprite_->setPosX(GAMECANVAS_CENTER_X + 10);
player_sprite_->setPosY(30);
tv_sprite_->setPosX(GAMECANVAS_CENTER_X - tv_sprite_->getWidth() - 10);