- [NEW] Afegit menu per a redefinir els botons del gamepad
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "m_gameover.h"
|
||||
#include "m_catslife.h"
|
||||
#include "m_menu_tecles.h"
|
||||
#include "m_menu_gamepad.h"
|
||||
#include "m_menu_audio.h"
|
||||
#include "m_editor_map.h"
|
||||
#include "m_editor_templates.h"
|
||||
@@ -32,12 +33,13 @@
|
||||
#define M_GAMEOVER 4
|
||||
#define M_CATSLIFE 5
|
||||
#define M_MENU_TECLES 6
|
||||
#define M_MENU_AUDIO 7
|
||||
#define M_EDITOR_MAP 8
|
||||
#define M_EDITOR_TEMPLATES 9
|
||||
#define M_EDITOR_COLORS 10
|
||||
#define M_EDITOR_BITMAP_FILE 11
|
||||
#define M_EDITOR_BITMAP 12
|
||||
#define M_MENU_GAMEPAD 7
|
||||
#define M_MENU_AUDIO 8
|
||||
#define M_EDITOR_MAP 9
|
||||
#define M_EDITOR_TEMPLATES 10
|
||||
#define M_EDITOR_COLORS 11
|
||||
#define M_EDITOR_BITMAP_FILE 12
|
||||
#define M_EDITOR_BITMAP 13
|
||||
|
||||
|
||||
int current_module = M_LOGO;
|
||||
@@ -69,6 +71,13 @@ void loadConfig()
|
||||
const int value = SDL_atoi( file::getConfigValue(nomtecles[i]).c_str() );
|
||||
if (value != 0) config::defineKey(i, value);
|
||||
}
|
||||
|
||||
static const char* nombotons[6] = {"btnup", "btndown", "btnleft", "btnright", "btnjump", "btnpick"};
|
||||
for (int i=0; i<6; ++i)
|
||||
{
|
||||
const int value = SDL_atoi( file::getConfigValue(nombotons[i]).c_str() );
|
||||
if (value != 0) config::defineKey(i, value);
|
||||
}
|
||||
}
|
||||
|
||||
void game::init()
|
||||
@@ -127,6 +136,7 @@ bool game::loop()
|
||||
if (option == OPTION_EIXIR) return false;
|
||||
if (option == OPTION_JUGAR) { modules::game::init(); current_module = M_GAME; }
|
||||
if (option == OPTION_TECLES) { modules::menu_tecles::init(); current_module = M_MENU_TECLES; }
|
||||
if (option == OPTION_GAMEPAD) { modules::menu_gamepad::init(); current_module = M_MENU_GAMEPAD; }
|
||||
if (option == OPTION_AUDIO) { modules::menu_audio::init(); current_module = M_MENU_AUDIO; }
|
||||
}
|
||||
break;
|
||||
@@ -210,6 +220,11 @@ bool game::loop()
|
||||
modules::menu::init(); current_module = M_MENU;
|
||||
}
|
||||
break;
|
||||
case M_MENU_GAMEPAD:
|
||||
if (modules::menu_gamepad::loop() == MENU_GAMEPAD_TORNAR) {
|
||||
modules::menu::init(); current_module = M_MENU;
|
||||
}
|
||||
break;
|
||||
case M_MENU_AUDIO:
|
||||
if (modules::menu_audio::loop() == MENU_AUDIO_TORNAR) {
|
||||
modules::menu::init(); current_module = M_MENU;
|
||||
|
||||
Reference in New Issue
Block a user