Ya escribe los creditos con colores
This commit is contained in:
@@ -23,30 +23,30 @@ Credits::Credits(SDL_Renderer *renderer, Screen *screen, Asset *asset)
|
||||
screen->setBorderColor(stringToColor("black"));
|
||||
|
||||
// Inicializa los textos
|
||||
texts.push_back("");
|
||||
texts.push_back("INSTRUCTIONS:");
|
||||
texts.push_back("");
|
||||
texts.push_back("HELP JAILDOC TO GET BACK ALL HIS");
|
||||
texts.push_back("PROJECTS AND GO TO THE JAIL TO");
|
||||
texts.push_back("FINISH THEM");
|
||||
texts.push_back("");
|
||||
texts.push_back("");
|
||||
texts.push_back("KEYS:");
|
||||
texts.push_back("");
|
||||
texts.push_back("USE CURSORS TO MOVE AND JUMP");
|
||||
texts.push_back("F1-F4 TO CHANGE WINDOWS SIZE");
|
||||
texts.push_back("F TO SWITCH TO FULLSCREEN");
|
||||
texts.push_back("B TO DE/ACTIVATE THE BORDER SC.");
|
||||
texts.push_back("M TO TURN ON/OFF THE MUSIC");
|
||||
texts.push_back("ESC TO EXIT GAME");
|
||||
texts.push_back("");
|
||||
texts.push_back("");
|
||||
texts.push_back("A GAME BY JAILDESIGNER");
|
||||
texts.push_back("MADE ON SUMMER/FALL 2022");
|
||||
texts.push_back("");
|
||||
texts.push_back("");
|
||||
texts.push_back("LOVE JAILGAMES!}");
|
||||
texts.push_back("");
|
||||
texts.push_back({"", stringToColor("white")});
|
||||
texts.push_back({"INSTRUCTIONS:", stringToColor("yellow")});
|
||||
texts.push_back({"", stringToColor("white")});
|
||||
texts.push_back({"HELP JAILDOC TO GET BACK ALL HIS", stringToColor("white")});
|
||||
texts.push_back({"PROJECTS AND GO TO THE JAIL TO", stringToColor("white")});
|
||||
texts.push_back({"FINISH THEM", stringToColor("white")});
|
||||
texts.push_back({"", stringToColor("white")});
|
||||
texts.push_back({"", stringToColor("white")});
|
||||
texts.push_back({"KEYS:", stringToColor("yellow")});
|
||||
texts.push_back({"", stringToColor("white")});
|
||||
texts.push_back({"USE CURSORS TO MOVE AND JUMP", stringToColor("white")});
|
||||
texts.push_back({"F1-F4 TO CHANGE WINDOWS SIZE", stringToColor("white")});
|
||||
texts.push_back({"F TO SWITCH TO FULLSCREEN", stringToColor("white")});
|
||||
texts.push_back({"B TO DE/ACTIVATE THE BORDER SC.", stringToColor("white")});
|
||||
texts.push_back({"M TO TURN ON/OFF THE MUSIC", stringToColor("white")});
|
||||
texts.push_back({"ESC TO EXIT GAME", stringToColor("white")});
|
||||
texts.push_back({"", stringToColor("white")});
|
||||
texts.push_back({"", stringToColor("white")});
|
||||
texts.push_back({"A GAME BY JAILDESIGNER", stringToColor("yellow")});
|
||||
texts.push_back({"MADE ON SUMMER/FALL 2022", stringToColor("yellow")});
|
||||
texts.push_back({"", stringToColor("white")});
|
||||
texts.push_back({"", stringToColor("white")});
|
||||
texts.push_back({"LOVE JAILGAMES!}", stringToColor("white")});
|
||||
texts.push_back({"", stringToColor("white")});
|
||||
|
||||
// Crea la textura para el texto que se escribe en pantalla
|
||||
textTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT);
|
||||
@@ -125,7 +125,7 @@ void Credits::fillTexture()
|
||||
|
||||
for (auto t : texts)
|
||||
{
|
||||
text->write(0, i * size, t);
|
||||
text->writeColored(0, i * size, t.label, t.color);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,11 +16,10 @@
|
||||
class Credits
|
||||
{
|
||||
private:
|
||||
struct letter_t
|
||||
struct captions_t
|
||||
{
|
||||
std::string letter; // Letra a escribir
|
||||
int x; // Posición en el eje x
|
||||
bool enabled; // Solo se escriben y mueven si estan habilitadas
|
||||
std::string label; // Texto a escribir
|
||||
color_t color; // Color del texto
|
||||
};
|
||||
|
||||
// Objetos y punteros
|
||||
@@ -37,7 +36,7 @@ private:
|
||||
section_t section; // Estado del bucle principal para saber si continua o se sale
|
||||
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||
std::vector<std::string> texts; // Vector con las letras de la marquesina
|
||||
std::vector<captions_t> texts; // Vector con las letras de la marquesina
|
||||
|
||||
// Actualiza las variables
|
||||
void update();
|
||||
|
||||
@@ -53,17 +53,16 @@ void ScoreBoard::render()
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
||||
SDL_RenderFillRect(renderer, &rect);
|
||||
|
||||
|
||||
// Dibuja las vidas
|
||||
sprite->setPosY(line2);
|
||||
int index;
|
||||
const int desp = (counter / 40) % 8;
|
||||
const int frame = desp % 4;
|
||||
sprite->setCurrentFrame(frame);
|
||||
|
||||
sprite->setPosY(line2);
|
||||
for (int i = 0; i < board->lives; ++i)
|
||||
{
|
||||
sprite->setPosX(8 + (16 * i) + desp);
|
||||
index = i % color.size();
|
||||
const int index = i % color.size();
|
||||
sprite->getTexture()->setColor(color[index].r, color[index].g, color[index].b);
|
||||
sprite->render();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user