From 55810344871167da45220f6210ad9bffd935837e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Valor=20Mart=C3=ADnez?= Date: Tue, 23 May 2023 17:46:37 +0200 Subject: [PATCH] =?UTF-8?q?Demo:=20a=C3=B1adido=20control=20con=20mando?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index 4c985fb..caadc3b 100644 --- a/main.cpp +++ b/main.cpp @@ -98,13 +98,13 @@ int main(int argc, char *argv[]) input->bindKey(INPUT_LEFT, SDL_SCANCODE_LEFT); input->bindKey(INPUT_RIGHT, SDL_SCANCODE_RIGHT); string controllerName = ""; - int numControllers= input->getNumControllers(); - if (numControllers>0) + int numControllers = input->getNumControllers(); + if (numControllers > 0) { - controllerName=getControllerName(1); + // Obtiene el nombre del primer mando conectado + controllerName = input->getControllerName(0); } - // Inicializa el texto Text *text = new Text(asset->get("smb2.txt"), asset->get("smb2.png"), renderer); Text *debugText = new Text(asset->get("debug.txt"), asset->get("debug.png"), renderer); @@ -277,7 +277,8 @@ int main(int argc, char *argv[]) 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, inputPressed); + debugText->writeCentered(options->screen.nativeWidth / 2, options->screen.nativeHeight / 2, controllerName); + debugText->writeCentered(options->screen.nativeWidth / 2, (options->screen.nativeHeight / 2) + debugText->getCharacterSize(), inputPressed); // Vuelca el buffer en pantalla screen->blit();