- [FIX] No se cridava a SDL_Init()

- [FIX] Ja funciona el gamepad
- [CHG] Canviat el format del temps en la pantalla de game over
- [CHG] Canvi en una habitació per a balancejar
This commit is contained in:
2024-10-02 20:40:10 +02:00
parent c92f2a13aa
commit 1f6956ad81
15 changed files with 85 additions and 48 deletions

View File

@@ -1,6 +1,7 @@
#include "m_menu_gamepad.h"
#include "jdraw.h"
#include "jinput.h"
#include "controller.h"
#include "config.h"
#include <SDL2/SDL.h>
@@ -12,12 +13,12 @@ namespace modules
int selected_option = MENU_GAMEPAD_AMUNT;
states state = STATE_SELECTING;
char name[6] = "PAD00";
char name[7] = "BTN 00";
const char *getPadBtnName(const int8_t key)
{
name[3] = (key/10)+48;
name[4] = (key%10)+48;
name[4] = (key/10)+48;
name[5] = (key%10)+48;
return name;
}
@@ -33,14 +34,13 @@ namespace modules
if (input::keyPressed(SDL_SCANCODE_ESCAPE)) {
return MENU_GAMEPAD_TORNAR;
}
if (input::keyPressed(SDL_SCANCODE_DOWN) || input::keyPressed(config::getKey(KEY_DOWN)))
if (controller::pressed(KEY_DOWN))
{ selected_option++; if (selected_option>6) selected_option=0; }
if (input::keyPressed(SDL_SCANCODE_UP) || input::keyPressed(config::getKey(KEY_UP)))
if (controller::pressed(KEY_UP))
{ selected_option--; if (selected_option<0) selected_option=6; }
if (input::keyPressed(SDL_SCANCODE_SPACE) || input::keyPressed(SDL_SCANCODE_RETURN) ||
input::keyPressed(config::getKey(KEY_JUMP)) || input::keyPressed(config::getKey(KEY_PICK))) {
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK)) {
if (selected_option==MENU_GAMEPAD_TORNAR)
return MENU_GAMEPAD_TORNAR;
else