forked from jaildesigner-jailgames/jaildoctors_dilemma
corregides cridades a SDL3 i migrat casi tot de int a float. Falta jail_shader
This commit is contained in:
@@ -343,20 +343,20 @@ void Ending2::renderTexts() {
|
||||
// Coloca los sprites en su sito
|
||||
void Ending2::placeSprites() {
|
||||
for (int i = 0; i < static_cast<int>(sprites_.size()); ++i) {
|
||||
const int X = i % 2 == 0 ? FIRST_COL_ : SECOND_COL_;
|
||||
const int Y = (i / 1) * (sprite_max_height_ + DIST_SPRITE_TEXT_ + Resource::get()->getText("smb2")->getCharacterSize() + DIST_SPRITE_SPRITE_) + options.game.height + 40;
|
||||
const int W = sprites_.at(i)->getWidth();
|
||||
const int H = sprites_.at(i)->getHeight();
|
||||
const int DX = -(W / 2);
|
||||
const int DY = sprite_max_height_ - H;
|
||||
const float X = i % 2 == 0 ? FIRST_COL_ : SECOND_COL_;
|
||||
const float Y = (i / 1) * (sprite_max_height_ + DIST_SPRITE_TEXT_ + Resource::get()->getText("smb2")->getCharacterSize() + DIST_SPRITE_SPRITE_) + options.game.height + 40;
|
||||
const float W = sprites_.at(i)->getWidth();
|
||||
const float H = sprites_.at(i)->getHeight();
|
||||
const float DX = -(W / 2);
|
||||
const float DY = sprite_max_height_ - H;
|
||||
|
||||
sprites_.at(i)->setPos({X + DX, Y + DY, W, H});
|
||||
sprites_.at(i)->setVelY(SPRITE_DESP_SPEED_);
|
||||
}
|
||||
|
||||
// Recoloca el sprite del jugador, que es el último de la lista
|
||||
const int X = (options.game.width - sprites_.back()->getWidth()) / 2;
|
||||
const int Y = sprites_.back()->getPosY() + sprite_max_height_ * 2;
|
||||
const float X = (options.game.width - sprites_.back()->getWidth()) / 2;
|
||||
const float Y = sprites_.back()->getPosY() + sprite_max_height_ * 2;
|
||||
sprites_.back()->setPos(X, Y);
|
||||
sprites_.back()->setCurrentAnimation("walk");
|
||||
}
|
||||
@@ -364,7 +364,7 @@ void Ending2::placeSprites() {
|
||||
// Crea los sprites con las texturas con los textos
|
||||
void Ending2::createSpriteTexts() {
|
||||
// Crea los sprites de texto a partir de la lista
|
||||
for (int i = 0; i < static_cast<int>(sprite_list_.size()); ++i) {
|
||||
for (size_t i = 0; i < sprite_list_.size(); ++i) {
|
||||
auto text = Resource::get()->getText("smb2");
|
||||
|
||||
// Procesa y ajusta el texto del sprite actual
|
||||
@@ -375,16 +375,16 @@ void Ending2::createSpriteTexts() {
|
||||
}
|
||||
|
||||
// Calcula las dimensiones del texto
|
||||
const int W = text->lenght(txt, 1);
|
||||
const int H = text->getCharacterSize();
|
||||
const float W = text->lenght(txt, 1);
|
||||
const float H = text->getCharacterSize();
|
||||
|
||||
// Determina la columna y la posición X del texto
|
||||
const int X = (i == static_cast<int>(sprite_list_.size()) - 1)
|
||||
const float X = (i == sprite_list_.size() - 1)
|
||||
? (GAMECANVAS_CENTER_X - (W / 2))
|
||||
: ((i % 2 == 0 ? FIRST_COL_ : SECOND_COL_) - (W / 2));
|
||||
|
||||
// Calcula la posición Y del texto en base a la posición y altura del sprite
|
||||
const int Y = sprites_.at(i)->getPosY() + sprites_.at(i)->getHeight() + DIST_SPRITE_TEXT_;
|
||||
const float Y = sprites_.at(i)->getPosY() + sprites_.at(i)->getHeight() + DIST_SPRITE_TEXT_;
|
||||
|
||||
// Crea la surface
|
||||
auto surface = std::make_shared<Surface>(W, H);
|
||||
@@ -393,7 +393,7 @@ void Ending2::createSpriteTexts() {
|
||||
text->write(0, 0, txt);
|
||||
|
||||
// Crea el sprite
|
||||
SDL_Rect pos = {X, Y, W, H};
|
||||
SDL_FRect pos = {X, Y, W, H};
|
||||
sprite_texts_.emplace_back(std::make_shared<SMovingSprite>(surface, pos));
|
||||
sprite_texts_.back()->setVelY(SPRITE_DESP_SPEED_);
|
||||
Screen::get()->setRendererSurface(previuos_renderer);
|
||||
@@ -409,22 +409,22 @@ void Ending2::createTexts() {
|
||||
auto text = Resource::get()->getText("smb2");
|
||||
|
||||
// Crea los sprites de texto a partir de la lista
|
||||
for (int i = 0; i < (int)list.size(); ++i) {
|
||||
for (size_t i = 0; i < list.size(); ++i) {
|
||||
// Calcula constantes
|
||||
const int w = text->lenght(list[i], 1);
|
||||
const int h = text->getCharacterSize();
|
||||
const int x = GAMECANVAS_CENTER_X;
|
||||
const int dx = -(w / 2);
|
||||
const int y = options.game.height + (text->getCharacterSize() * (i * 2));
|
||||
const float W = text->lenght(list[i], 1);
|
||||
const float H = text->getCharacterSize();
|
||||
const float X = GAMECANVAS_CENTER_X;
|
||||
const float DX = -(W / 2);
|
||||
const float Y = options.game.height + (text->getCharacterSize() * (i * 2));
|
||||
|
||||
// Crea la surface
|
||||
auto surface = std::make_shared<Surface>(w, h);
|
||||
auto surface = std::make_shared<Surface>(W, H);
|
||||
auto previuos_renderer = Screen::get()->getRendererSurface();
|
||||
Screen::get()->setRendererSurface(surface);
|
||||
text->write(0, 0, list[i]);
|
||||
|
||||
// Crea el sprite
|
||||
SDL_Rect pos = {x + dx, y, w, h};
|
||||
SDL_FRect pos = {X + DX, Y, W, H};
|
||||
texts_.emplace_back(std::make_shared<SMovingSprite>(surface, pos));
|
||||
texts_.back()->setVelY(SPRITE_DESP_SPEED_);
|
||||
Screen::get()->setRendererSurface(previuos_renderer);
|
||||
@@ -438,22 +438,22 @@ void Ending2::createTexts() {
|
||||
list.push_back("FOR PLAYING!");
|
||||
|
||||
// Crea los sprites de texto a partir de la lista
|
||||
for (int i = 0; i < (int)list.size(); ++i) {
|
||||
for (size_t i = 0; i < list.size(); ++i) {
|
||||
// Calcula constantes
|
||||
const int w = text->lenght(list[i], 1);
|
||||
const int h = text->getCharacterSize();
|
||||
const int x = GAMECANVAS_CENTER_X;
|
||||
const int dx = -(w / 2);
|
||||
const int y = START + (text->getCharacterSize() * (i * 2));
|
||||
const float W = text->lenght(list[i], 1);
|
||||
const float H = text->getCharacterSize();
|
||||
const float X = GAMECANVAS_CENTER_X;
|
||||
const float DX = -(W / 2);
|
||||
const float Y = START + (text->getCharacterSize() * (i * 2));
|
||||
|
||||
// Crea la surface
|
||||
auto surface = std::make_shared<Surface>(w, h);
|
||||
auto surface = std::make_shared<Surface>(W, H);
|
||||
auto previuos_renderer = Screen::get()->getRendererSurface();
|
||||
Screen::get()->setRendererSurface(surface);
|
||||
text->write(0, 0, list[i]);
|
||||
|
||||
// Crea el sprite
|
||||
SDL_Rect pos = {x + dx, y, w, h};
|
||||
SDL_FRect pos = {X + DX, Y, W, H};
|
||||
texts_.emplace_back(std::make_shared<SMovingSprite>(surface, pos));
|
||||
texts_.back()->setVelY(SPRITE_DESP_SPEED_);
|
||||
Screen::get()->setRendererSurface(previuos_renderer);
|
||||
|
||||
Reference in New Issue
Block a user