demo: Modificado el texto en pantalla

This commit is contained in:
2023-05-23 22:55:56 +02:00
parent 4424f2c2d3
commit 0674e44b52

View File

@@ -91,7 +91,7 @@ int main(int argc, char *argv[])
// Inicializa el objeto input // Inicializa el objeto input
Input *input = new Input(asset->get("gamecontrollerdb.txt"), options->console); Input *input = new Input(asset->get("gamecontrollerdb.txt"), options->console);
string controllerName = input->getControllerName(0); string controllerName = input->getNumControllers() > 0 ? input->getControllerName(0) : "No se ha encontrado ningun mando";
// Inicializa el texto // Inicializa el texto
Text *text = new Text(asset->get("smb2.txt"), asset->get("smb2.png"), renderer); Text *text = new Text(asset->get("smb2.txt"), asset->get("smb2.png"), renderer);
@@ -133,11 +133,11 @@ int main(int argc, char *argv[])
should_exit = true; should_exit = true;
break; break;
case SDL_SCANCODE_1: case SDL_SCANCODE_F1:
screen->decWindowSize(); screen->decWindowSize();
break; break;
case SDL_SCANCODE_2: case SDL_SCANCODE_F2:
screen->incWindowSize(); screen->incWindowSize();
break; break;
@@ -153,19 +153,19 @@ int main(int argc, char *argv[])
string inputPressed = ""; string inputPressed = "";
if (input->checkInput(INPUT_LEFT)) if (input->checkInput(INPUT_LEFT))
{ {
inputPressed = "LEFT"; inputPressed = "Izquierda";
} }
if (input->checkInput(INPUT_RIGHT)) if (input->checkInput(INPUT_RIGHT))
{ {
inputPressed = "RIGHT"; inputPressed = "Derecha";
} }
if (input->checkInput(INPUT_UP)) if (input->checkInput(INPUT_UP))
{ {
inputPressed = "UP"; inputPressed = "Arriba";
} }
if (input->checkInput(INPUT_DOWN)) if (input->checkInput(INPUT_DOWN))
{ {
inputPressed = "DOWN"; inputPressed = "Abajo";
} }
// Actualiza la lógica del programa // Actualiza la lógica del programa
@@ -261,12 +261,14 @@ int main(int argc, char *argv[])
// Escribe el texto // Escribe el texto
text->setZoom(2); text->setZoom(2);
text->writeDX(TXT_CENTER | TXT_SHADOW, options->screen.nativeWidth / 2, text->getCharacterSize(), "Jail Engine DEMO", 1, {255, 255, 255}, 1, {48, 48, 48}); text->writeDX(TXT_CENTER | TXT_STROKE, options->screen.nativeWidth / 2, text->getCharacterSize(), "Jail Engine DEMO", 1, {255, 255, 255}, 1, {0, 0, 192});
text->disableZoom(); text->disableZoom();
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, options->screen.nativeWidth / 2, text->getCharacterSize() * 7, "Pulsa 'N' para mostrar", 1, {240, 240, 240}, 1, {0, 0, 192}); text->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, options->screen.nativeWidth / 2, text->getCharacterSize() * 4, "2023 JailDesigner", 1, {240, 240, 240}, 1, {0, 0, 192});
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, options->screen.nativeWidth / 2, text->getCharacterSize() * 8, "una notificacion", 1, {240, 240, 240}, 1, {0, 0, 192}); debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, options->screen.nativeWidth / 2, text->getCharacterSize() * 7, "Pulsa 'F1' o 'F2' para disminuir o aumentar la ventana", 1, {240, 240, 240}, 1, {0, 0, 192});
debugText->writeCentered(options->screen.nativeWidth / 2, options->screen.nativeHeight / 2, controllerName); debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, options->screen.nativeWidth / 2, text->getCharacterSize() * 9, "Pulsa 'N' para mostrar una notificacion", 1, {240, 240, 240}, 1, {0, 0, 192});
debugText->writeCentered(options->screen.nativeWidth / 2, (options->screen.nativeHeight / 2) + (debugText->getCharacterSize() * 2), inputPressed); debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, options->screen.nativeWidth / 2, text->getCharacterSize() * 11, controllerName, 1, {240, 240, 240}, 1, {0, 0, 192});
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, options->screen.nativeWidth / 2, text->getCharacterSize() * 13, inputPressed, 1, {240, 240, 240}, 1, {0, 0, 192});
debugText->writeDX(TXT_CENTER | TXT_COLOR | TXT_STROKE, options->screen.nativeWidth / 2, options->screen.nativeHeight - (text->getCharacterSize() * 2), "Pulsa 'ESCAPE' para terminar el programa", 1, {240, 240, 240}, 1, {0, 0, 192});
// Vuelca el buffer en pantalla // Vuelca el buffer en pantalla
screen->blit(); screen->blit();