Compare commits
2 Commits
4424f2c2d3
...
1a40212b7a
| Author | SHA1 | Date | |
|---|---|---|---|
| 1a40212b7a | |||
| 0674e44b52 |
28
main.cpp
28
main.cpp
@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Inicializa SDL y la ventana
|
||||
SDL_Init(SDL_INIT_EVERYTHING);
|
||||
window = SDL_CreateWindow("jail_engine_demo", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, options->screen.nativeWidth * options->screen.nativeZoom * options->screen.windowZoom, options->screen.nativeHeight * options->screen.nativeZoom * options->screen.windowZoom, SDL_WINDOW_SHOWN);
|
||||
window = SDL_CreateWindow("Jail Engine DEMO", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, options->screen.nativeWidth * options->screen.nativeZoom * options->screen.windowZoom, options->screen.nativeHeight * options->screen.nativeZoom * options->screen.windowZoom, SDL_WINDOW_SHOWN);
|
||||
// window = SDL_CreateWindow("jail_engine_demo", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 320, 240, SDL_WINDOW_SHOWN);
|
||||
if (window != nullptr)
|
||||
{
|
||||
@@ -91,7 +91,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Inicializa el objeto input
|
||||
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
|
||||
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;
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_1:
|
||||
case SDL_SCANCODE_F1:
|
||||
screen->decWindowSize();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_2:
|
||||
case SDL_SCANCODE_F2:
|
||||
screen->incWindowSize();
|
||||
break;
|
||||
|
||||
@@ -153,19 +153,19 @@ int main(int argc, char *argv[])
|
||||
string inputPressed = "";
|
||||
if (input->checkInput(INPUT_LEFT))
|
||||
{
|
||||
inputPressed = "LEFT";
|
||||
inputPressed = "Izquierda";
|
||||
}
|
||||
if (input->checkInput(INPUT_RIGHT))
|
||||
{
|
||||
inputPressed = "RIGHT";
|
||||
inputPressed = "Derecha";
|
||||
}
|
||||
if (input->checkInput(INPUT_UP))
|
||||
{
|
||||
inputPressed = "UP";
|
||||
inputPressed = "Arriba";
|
||||
}
|
||||
if (input->checkInput(INPUT_DOWN))
|
||||
{
|
||||
inputPressed = "DOWN";
|
||||
inputPressed = "Abajo";
|
||||
}
|
||||
|
||||
// Actualiza la lógica del programa
|
||||
@@ -261,12 +261,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Escribe el texto
|
||||
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->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() * 8, "una notificacion", 1, {240, 240, 240}, 1, {0, 0, 192});
|
||||
debugText->writeCentered(options->screen.nativeWidth / 2, options->screen.nativeHeight / 2, controllerName);
|
||||
debugText->writeCentered(options->screen.nativeWidth / 2, (options->screen.nativeHeight / 2) + (debugText->getCharacterSize() * 2), inputPressed);
|
||||
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});
|
||||
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->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->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
|
||||
screen->blit();
|
||||
|
||||
Reference in New Issue
Block a user