forked from jaildesigner-jailgames/jaildoctors_dilemma
Transició a surface: vaig per title.cpp
This commit is contained in:
@@ -1,32 +1,32 @@
|
||||
#include "logo.h"
|
||||
#include <SDL2/SDL_events.h> // for SDL_PollEvent, SDL_Event
|
||||
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
|
||||
#include <string> // for basic_string, string
|
||||
#include "defines.h" // for GAME_SPEED
|
||||
#include "global_events.h" // for check
|
||||
#include "global_inputs.h" // for check
|
||||
#include "jail_audio.h" // for JA_StopMusic
|
||||
#include "options.h" // for Options, options, SectionState, Section
|
||||
#include "resource.h" // for Resource
|
||||
#include "screen.h" // for Screen
|
||||
#include "sprite.h" // for Sprite
|
||||
#include "texture.h" // for Texture
|
||||
#include "utils.h" // for Color, stringToColor
|
||||
#include <SDL2/SDL_events.h> // for SDL_PollEvent, SDL_Event
|
||||
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
|
||||
#include <string> // for basic_string, string
|
||||
#include "defines.h" // for GAME_SPEED
|
||||
#include "global_events.h" // for check
|
||||
#include "global_inputs.h" // for check
|
||||
#include "jail_audio.h" // for JA_StopMusic
|
||||
#include "options.h" // for Options, options, SectionState, Section
|
||||
#include "resource.h" // for Resource
|
||||
#include "screen.h" // for Screen
|
||||
#include "s_sprite.h" // for SSprite
|
||||
#include "surface.h" // for Texture
|
||||
#include "utils.h" // for Color, stringToColor
|
||||
|
||||
// Constructor
|
||||
Logo::Logo()
|
||||
: jailgames_texture_(Resource::get()->getTexture("jailgames.png")),
|
||||
since_1998_texture_(Resource::get()->getTexture("since_1998.png")),
|
||||
since_1998_sprite_(std::make_shared<Sprite>(since_1998_texture_, (256 - since_1998_texture_->getWidth()) / 2, 83 + jailgames_texture_->getHeight() + 5, since_1998_texture_->getWidth(), since_1998_texture_->getHeight()))
|
||||
: 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_->setClip(0, 0, since_1998_texture_->getWidth(), since_1998_texture_->getHeight());
|
||||
since_1998_texture_->setColor(0, 0, 0);
|
||||
since_1998_sprite_->setClip(0, 0, since_1998_surface_->getWidth(), since_1998_surface_->getHeight());
|
||||
//since_1998_surface_->setColor(0, 0, 0);
|
||||
|
||||
// Crea los sprites de cada linea
|
||||
for (int i = 0; i < jailgames_texture_->getHeight(); ++i)
|
||||
for (int i = 0; i < jailgames_surface_->getHeight(); ++i)
|
||||
{
|
||||
jailgames_sprite_.push_back(std::make_shared<Sprite>(jailgames_texture_, 0, i, jailgames_texture_->getWidth(), 1));
|
||||
jailgames_sprite_.back()->setClip(0, i, jailgames_texture_->getWidth(), 1);
|
||||
jailgames_sprite_.push_back(std::make_shared<SSprite>(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);
|
||||
}
|
||||
@@ -98,88 +98,89 @@ void Logo::updateTextureColors()
|
||||
{
|
||||
constexpr int INI = 70;
|
||||
constexpr int INC = 4;
|
||||
|
||||
/*
|
||||
if (counter_ == INI + INC * 0)
|
||||
{
|
||||
since_1998_texture_->setColor(color_.at(0).r, color_.at(0).g, color_.at(0).b);
|
||||
since_1998_surface_->setColor(color_.at(0).r, color_.at(0).g, color_.at(0).b);
|
||||
}
|
||||
|
||||
else if (counter_ == INI + INC * 1)
|
||||
{
|
||||
since_1998_texture_->setColor(color_.at(1).r, color_.at(1).g, color_.at(1).b);
|
||||
since_1998_surface_->setColor(color_.at(1).r, color_.at(1).g, color_.at(1).b);
|
||||
}
|
||||
|
||||
else if (counter_ == INI + INC * 2)
|
||||
{
|
||||
since_1998_texture_->setColor(color_.at(2).r, color_.at(2).g, color_.at(2).b);
|
||||
since_1998_surface_->setColor(color_.at(2).r, color_.at(2).g, color_.at(2).b);
|
||||
}
|
||||
|
||||
else if (counter_ == INI + INC * 3)
|
||||
{
|
||||
since_1998_texture_->setColor(color_.at(3).r, color_.at(3).g, color_.at(3).b);
|
||||
since_1998_surface_->setColor(color_.at(3).r, color_.at(3).g, color_.at(3).b);
|
||||
}
|
||||
|
||||
else if (counter_ == INI + INC * 4)
|
||||
{
|
||||
since_1998_texture_->setColor(color_.at(4).r, color_.at(4).g, color_.at(4).b);
|
||||
since_1998_surface_->setColor(color_.at(4).r, color_.at(4).g, color_.at(4).b);
|
||||
}
|
||||
|
||||
else if (counter_ == INI + INC * 5)
|
||||
{
|
||||
since_1998_texture_->setColor(color_.at(5).r, color_.at(5).g, color_.at(5).b);
|
||||
since_1998_surface_->setColor(color_.at(5).r, color_.at(5).g, color_.at(5).b);
|
||||
}
|
||||
|
||||
else if (counter_ == INI + INC * 6)
|
||||
{
|
||||
since_1998_texture_->setColor(color_.at(6).r, color_.at(6).g, color_.at(6).b);
|
||||
since_1998_surface_->setColor(color_.at(6).r, color_.at(6).g, color_.at(6).b);
|
||||
}
|
||||
|
||||
else if (counter_ == INI + INC * 7)
|
||||
{
|
||||
since_1998_texture_->setColor(color_.at(7).r, color_.at(7).g, color_.at(7).b);
|
||||
since_1998_surface_->setColor(color_.at(7).r, color_.at(7).g, color_.at(7).b);
|
||||
}
|
||||
|
||||
else if (counter_ == INIT_FADE_ + INC * 0)
|
||||
{
|
||||
jailgames_texture_->setColor(color_.at(6).r, color_.at(6).g, color_.at(6).b);
|
||||
since_1998_texture_->setColor(color_.at(6).r, color_.at(6).g, color_.at(6).b);
|
||||
jailgames_surface_->setColor(color_.at(6).r, color_.at(6).g, color_.at(6).b);
|
||||
since_1998_surface_->setColor(color_.at(6).r, color_.at(6).g, color_.at(6).b);
|
||||
}
|
||||
|
||||
else if (counter_ == INIT_FADE_ + INC * 1)
|
||||
{
|
||||
jailgames_texture_->setColor(color_.at(5).r, color_.at(5).g, color_.at(5).b);
|
||||
since_1998_texture_->setColor(color_.at(5).r, color_.at(5).g, color_.at(5).b);
|
||||
jailgames_surface_->setColor(color_.at(5).r, color_.at(5).g, color_.at(5).b);
|
||||
since_1998_surface_->setColor(color_.at(5).r, color_.at(5).g, color_.at(5).b);
|
||||
}
|
||||
|
||||
else if (counter_ == INIT_FADE_ + INC * 2)
|
||||
{
|
||||
jailgames_texture_->setColor(color_.at(4).r, color_.at(4).g, color_.at(4).b);
|
||||
since_1998_texture_->setColor(color_.at(4).r, color_.at(4).g, color_.at(4).b);
|
||||
jailgames_surface_->setColor(color_.at(4).r, color_.at(4).g, color_.at(4).b);
|
||||
since_1998_surface_->setColor(color_.at(4).r, color_.at(4).g, color_.at(4).b);
|
||||
}
|
||||
|
||||
else if (counter_ == INIT_FADE_ + INC * 3)
|
||||
{
|
||||
jailgames_texture_->setColor(color_.at(3).r, color_.at(3).g, color_.at(3).b);
|
||||
since_1998_texture_->setColor(color_.at(3).r, color_.at(3).g, color_.at(3).b);
|
||||
jailgames_surface_->setColor(color_.at(3).r, color_.at(3).g, color_.at(3).b);
|
||||
since_1998_surface_->setColor(color_.at(3).r, color_.at(3).g, color_.at(3).b);
|
||||
}
|
||||
|
||||
else if (counter_ == INIT_FADE_ + INC * 4)
|
||||
{
|
||||
jailgames_texture_->setColor(color_.at(2).r, color_.at(2).g, color_.at(2).b);
|
||||
since_1998_texture_->setColor(color_.at(2).r, color_.at(2).g, color_.at(2).b);
|
||||
jailgames_surface_->setColor(color_.at(2).r, color_.at(2).g, color_.at(2).b);
|
||||
since_1998_surface_->setColor(color_.at(2).r, color_.at(2).g, color_.at(2).b);
|
||||
}
|
||||
|
||||
else if (counter_ == INIT_FADE_ + INC * 5)
|
||||
{
|
||||
jailgames_texture_->setColor(color_.at(1).r, color_.at(1).g, color_.at(1).b);
|
||||
since_1998_texture_->setColor(color_.at(1).r, color_.at(1).g, color_.at(1).b);
|
||||
jailgames_surface_->setColor(color_.at(1).r, color_.at(1).g, color_.at(1).b);
|
||||
since_1998_surface_->setColor(color_.at(1).r, color_.at(1).g, color_.at(1).b);
|
||||
}
|
||||
|
||||
else if (counter_ == INIT_FADE_ + INC * 6)
|
||||
{
|
||||
jailgames_texture_->setColor(color_.at(0).r, color_.at(0).g, color_.at(0).b);
|
||||
since_1998_texture_->setColor(color_.at(0).r, color_.at(0).g, color_.at(0).b);
|
||||
jailgames_surface_->setColor(color_.at(0).r, color_.at(0).g, color_.at(0).b);
|
||||
since_1998_surface_->setColor(color_.at(0).r, color_.at(0).g, color_.at(0).b);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// Actualiza las variables
|
||||
|
||||
Reference in New Issue
Block a user