mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-22 03:19:24 +01:00
Keyboard input: Add option to use cursor keys as cursors instead of
joystick
This commit is contained in:
parent
fd5fe7825f
commit
17d70cc3ef
@ -586,12 +586,38 @@ void C64Display::TranslateKey(SDLKey key, bool key_up, uint8 *key_matrix,
|
||||
case SDLK_RSHIFT: c64_key = MATRIX(6,4); break;
|
||||
case SDLK_LALT: case SDLK_LMETA: c64_key = MATRIX(7,5); break;
|
||||
case SDLK_RALT: case SDLK_RMETA: c64_key = MATRIX(7,5); break;
|
||||
|
||||
case SDLK_UP: c64_key = 0x01 | 0x40; break;
|
||||
case SDLK_DOWN: c64_key = 0x02 | 0x40; break;
|
||||
case SDLK_LEFT: c64_key = 0x04 | 0x40; break;
|
||||
case SDLK_RIGHT: c64_key = 0x08 | 0x40; break;
|
||||
|
||||
case SDLK_UP:
|
||||
{
|
||||
if (ThePrefs.CursorKeysForJoystick)
|
||||
c64_key = 0x01 | 0x40;
|
||||
else
|
||||
c64_key = MATRIX(0,7) | 0x80;
|
||||
break;
|
||||
}
|
||||
case SDLK_DOWN:
|
||||
{
|
||||
if (ThePrefs.CursorKeysForJoystick)
|
||||
c64_key = 0x02 | 0x40;
|
||||
else
|
||||
c64_key = MATRIX(0,7);
|
||||
break;
|
||||
}
|
||||
case SDLK_LEFT:
|
||||
{
|
||||
if (ThePrefs.CursorKeysForJoystick)
|
||||
c64_key = 0x04 | 0x40;
|
||||
else
|
||||
c64_key = MATRIX(0,2) | 0x80;
|
||||
break;
|
||||
}
|
||||
case SDLK_RIGHT:
|
||||
{
|
||||
if (ThePrefs.CursorKeysForJoystick)
|
||||
c64_key = 0x08 | 0x40;
|
||||
else
|
||||
c64_key = MATRIX(0,2);
|
||||
break;
|
||||
}
|
||||
case SDLK_F1: c64_key = MATRIX(0,4); break;
|
||||
case SDLK_F2: c64_key = MATRIX(0,4) | 0x80; break;
|
||||
case SDLK_F3: c64_key = MATRIX(0,5); break;
|
||||
|
@ -118,6 +118,7 @@ Prefs::Prefs()
|
||||
snprintf(this->NetworkServer, 64, "play.c64-network.org");
|
||||
this->NetworkPort = 46214;
|
||||
this->NetworkRegion = REGION_UNKNOWN;
|
||||
this->CursorKeysForJoystick = true;
|
||||
|
||||
strcpy(this->Theme, "default");
|
||||
}
|
||||
@ -319,6 +320,7 @@ bool Prefs::operator==(const Prefs &rhs) const
|
||||
&& strcmp(this->NetworkName, rhs.NetworkName) == 0
|
||||
&& strcmp(this->Theme, rhs.Theme) == 0
|
||||
&& this->NetworkAvatar == rhs.NetworkAvatar
|
||||
&& this->CursorKeysForJoystick == rhs.CursorKeysForJoystick
|
||||
);
|
||||
}
|
||||
|
||||
@ -504,6 +506,8 @@ void Prefs::Load(const char *filename)
|
||||
NetworkAvatar = atoi(value);
|
||||
else if (!strcmp(keyword, "Theme"))
|
||||
strcpy(Theme, value);
|
||||
else if (!strcmp(keyword, "CursorKeysForJoystick"))
|
||||
CursorKeysForJoystick = !strcmp(value, "TRUE");
|
||||
}
|
||||
}
|
||||
fclose(file);
|
||||
@ -616,6 +620,7 @@ bool Prefs::Save(const char *filename)
|
||||
maybe_write(file, NetworkPort != TheDefaultPrefs.NetworkPort, "NetworkPort = %d\n", NetworkPort);
|
||||
maybe_write(file, NetworkRegion != TheDefaultPrefs.NetworkRegion, "NetworkRegion = %d\n", NetworkRegion);
|
||||
maybe_write(file, strcmp(Theme, TheDefaultPrefs.Theme) != 0, "Theme = %s\n", Theme);
|
||||
maybe_write(file, CursorKeysForJoystick != TheDefaultPrefs.CursorKeysForJoystick, "CursorKeysForJoystick = %s\n", CursorKeysForJoystick ? "TRUE" : "FALSE");
|
||||
fclose(file);
|
||||
ThePrefsOnDisk = *this;
|
||||
return true;
|
||||
|
@ -172,6 +172,8 @@ public:
|
||||
int NetworkKey;
|
||||
uint16 NetworkAvatar;
|
||||
char Theme[128];
|
||||
|
||||
bool CursorKeysForJoystick;
|
||||
};
|
||||
|
||||
|
||||
|
@ -95,6 +95,13 @@ public:
|
||||
case 1:
|
||||
Gui::gui->pushView(Gui::gui->bkv);
|
||||
break;
|
||||
case 2:
|
||||
Gui::gui->np->CursorKeysForJoystick = !Gui::gui->np->CursorKeysForJoystick;
|
||||
if (Gui::gui->np->CursorKeysForJoystick)
|
||||
Gui::gui->status_bar->queueMessage("Cursor keys used as joystick");
|
||||
else
|
||||
Gui::gui->status_bar->queueMessage("Cursor keys used as keyboard cursors");
|
||||
break;
|
||||
default:
|
||||
panic("Illegal selection\n");
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ const char *main_menu_messages[14] = {
|
||||
/*02*/ "States",
|
||||
/*03*/ "^|Load|Save|Delete",
|
||||
/*04*/ "Keyboard",
|
||||
/*05*/ "^|Type|Bind",
|
||||
/*05*/ "^|Type|Bind|Toggle crsr",
|
||||
/*06*/ " ",
|
||||
/*07*/ "Game info",
|
||||
/*08*/ "Networking",
|
||||
@ -158,8 +158,10 @@ const char **main_menu_help[14] = {
|
||||
NULL,
|
||||
(const char*[]){
|
||||
"Bind keyboard keys to the",
|
||||
"joysticks, or type with",
|
||||
"the virtual keyboard",
|
||||
"joysticks, toggle cursor",
|
||||
"key settings (joystick or",
|
||||
"cursors) or type with the",
|
||||
"virtual keyboard",
|
||||
NULL,
|
||||
},
|
||||
NULL,
|
||||
|
Loading…
Reference in New Issue
Block a user