forked from jaildesigner-jailgames/jaildoctors_dilemma
Trabajando en los creditos
This commit is contained in:
@@ -23,9 +23,38 @@ Credits::Credits(SDL_Renderer *renderer, Screen *screen, Asset *asset)
|
|||||||
screen->setBorderColor(stringToColor("black"));
|
screen->setBorderColor(stringToColor("black"));
|
||||||
|
|
||||||
// Inicializa los textos
|
// Inicializa los textos
|
||||||
texts.push_back("ESTE ES UN TEXTO DE PRUEBA");
|
texts.push_back("");
|
||||||
texts.push_back("PARA VER COMO FUNCIONA LA CLASE");
|
texts.push_back("INSTRUCTIONS:");
|
||||||
texts.push_back("Y TENGO QUE PONER ALGUN TEXTO PARA PROBAR");
|
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("");
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
if (textTexture == NULL)
|
||||||
|
printf("Error: textTexture could not be created!\nSDL Error: %s\n", SDL_GetError());
|
||||||
|
|
||||||
|
// Escribe el texto en la textura
|
||||||
|
fillTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
@@ -69,6 +98,23 @@ void Credits::checkEventHandler()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Escribe el texto en la textura
|
||||||
|
void Credits::fillTexture()
|
||||||
|
{
|
||||||
|
SDL_SetRenderTarget(renderer, textTexture);
|
||||||
|
SDL_SetTextureBlendMode(textTexture, SDL_BLENDMODE_BLEND);
|
||||||
|
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0x00);
|
||||||
|
SDL_RenderClear(renderer);
|
||||||
|
|
||||||
|
// Escribe el texto en la textura
|
||||||
|
for (int i = 0; i < texts.size(); ++i)
|
||||||
|
{
|
||||||
|
text->write(0, i * 8, texts[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_SetRenderTarget(renderer, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
// Actualiza las variables
|
// Actualiza las variables
|
||||||
void Credits::update()
|
void Credits::update()
|
||||||
{
|
{
|
||||||
@@ -85,7 +131,7 @@ void Credits::update()
|
|||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
// Comprueba si ha terminado la sección
|
// Comprueba si ha terminado la sección
|
||||||
if (counter>1000)
|
if (counter > 1000)
|
||||||
{
|
{
|
||||||
section.name = SECTION_PROG_LOGO;
|
section.name = SECTION_PROG_LOGO;
|
||||||
}
|
}
|
||||||
@@ -101,13 +147,11 @@ void Credits::render()
|
|||||||
// Limpia la pantalla
|
// Limpia la pantalla
|
||||||
screen->clean();
|
screen->clean();
|
||||||
|
|
||||||
// Dibuja el contenido de la sección
|
SDL_Rect rect = {0, 0, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT};
|
||||||
//const color_t color = stringToColor("black");
|
|
||||||
//SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 255);
|
// Dibuja la textura con el mapa en pantalla
|
||||||
//SDL_RenderFillRect(renderer)
|
SDL_RenderCopy(renderer, textTexture, &rect, NULL);
|
||||||
text->write(8,8,texts[0]);
|
|
||||||
text->write(8,16,texts[1]);
|
|
||||||
text->write(8,24,texts[2]);
|
|
||||||
|
|
||||||
// Vuelca el contenido del renderizador en pantalla
|
// Vuelca el contenido del renderizador en pantalla
|
||||||
screen->blit();
|
screen->blit();
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ private:
|
|||||||
int ticks; // Contador de ticks para ajustar la velocidad del programa
|
int ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||||
int ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
int 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<std::string> texts; // Vector con las letras de la marquesina
|
||||||
|
SDL_Texture *textTexture; // Textura para dibujar el texto
|
||||||
|
|
||||||
// Actualiza las variables
|
// Actualiza las variables
|
||||||
void update();
|
void update();
|
||||||
@@ -44,11 +45,8 @@ private:
|
|||||||
// Comprueba el manejador de eventos
|
// Comprueba el manejador de eventos
|
||||||
void checkEventHandler();
|
void checkEventHandler();
|
||||||
|
|
||||||
// Actualiza la marquesina
|
// Escribe el texto en la textura
|
||||||
void updateMarquee();
|
void fillTexture();
|
||||||
|
|
||||||
// Dibuja la marquesina
|
|
||||||
void renderMarquee();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Director::Director(std::string path)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
section.name = SECTION_PROG_GAME;
|
section.name = SECTION_PROG_CREDITS;
|
||||||
section.subsection = 0;
|
section.subsection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
/*
|
/*
|
||||||
Cada habitación se crea y destruye cada vez que se entra o sale de la misma
|
Cada habitación se crea y destruye cada vez que se entra o sale de la misma
|
||||||
Cada habitacion tiene lo siguiente:
|
Cada habitacion tiene lo siguiente:
|
||||||
- ID (numerico)
|
|
||||||
- NOMBRE (texto)
|
- NOMBRE (texto)
|
||||||
- COLOR DE FONDO (texto)
|
- COLOR DE FONDO (texto)
|
||||||
- COLOR DEL BORDE (texto)
|
- COLOR DEL BORDE (texto)
|
||||||
|
|||||||
Reference in New Issue
Block a user