mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-04-01 17:53:07 +02:00
starting branch
This commit is contained in:
@@ -31,8 +31,25 @@ bool UserInput::Initialize()
|
|||||||
{
|
{
|
||||||
bool retVal = true;
|
bool retVal = true;
|
||||||
|
|
||||||
retVal = MapKey("nextItem", KeyCodeNextItem) && retVal;
|
if(!MapKey("up", KeyCodeUp))
|
||||||
retVal = MapKey("previousItem", KeyCodePreviousItem) && retVal;
|
{
|
||||||
|
retVal = MapKey("previousItem", KeyCodeUp) && retVal;
|
||||||
|
}
|
||||||
|
if(!MapKey("down", KeyCodePageDown))
|
||||||
|
{
|
||||||
|
retVal = MapKey("nextItem", KeyCodeDown) && retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!MapKey("left", KeyCodeLeft))
|
||||||
|
{
|
||||||
|
retVal = MapKey("previousItem", KeyCodeLeft) && retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!MapKey("right", KeyCodeRight))
|
||||||
|
{
|
||||||
|
retVal = MapKey("nextItem", KeyCodeRight) && retVal;
|
||||||
|
}
|
||||||
|
|
||||||
retVal = MapKey("pageDown", KeyCodePageDown) && retVal;
|
retVal = MapKey("pageDown", KeyCodePageDown) && retVal;
|
||||||
retVal = MapKey("pageUp", KeyCodePageUp) && retVal;
|
retVal = MapKey("pageUp", KeyCodePageUp) && retVal;
|
||||||
retVal = MapKey("select", KeyCodeSelect) && retVal;
|
retVal = MapKey("select", KeyCodeSelect) && retVal;
|
||||||
@@ -61,7 +78,6 @@ SDL_Scancode UserInput::GetScancode(KeyCode_E key)
|
|||||||
|
|
||||||
bool UserInput::MapKey(std::string keyDescription, KeyCode_E key)
|
bool UserInput::MapKey(std::string keyDescription, KeyCode_E key)
|
||||||
{
|
{
|
||||||
bool retVal = false;
|
|
||||||
SDL_Scancode scanCode;
|
SDL_Scancode scanCode;
|
||||||
std::string description;
|
std::string description;
|
||||||
|
|
||||||
@@ -70,22 +86,17 @@ bool UserInput::MapKey(std::string keyDescription, KeyCode_E key)
|
|||||||
if(!Config.GetProperty(configKey, description))
|
if(!Config.GetProperty(configKey, description))
|
||||||
{
|
{
|
||||||
Logger::Write(Logger::ZONE_ERROR, "Configuration", "Missing property " + configKey);
|
Logger::Write(Logger::ZONE_ERROR, "Configuration", "Missing property " + configKey);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
scanCode = SDL_GetScancodeFromName(description.c_str());
|
||||||
|
|
||||||
|
if(scanCode == SDL_SCANCODE_UNKNOWN)
|
||||||
{
|
{
|
||||||
scanCode = SDL_GetScancodeFromName(description.c_str());
|
Logger::Write(Logger::ZONE_ERROR, "Configuration", "Unsupported property value for " + configKey + "(" + description + "). See Documentation/Keycodes.txt for valid inputs");
|
||||||
|
return false;
|
||||||
if(scanCode == SDL_SCANCODE_UNKNOWN)
|
|
||||||
{
|
|
||||||
Logger::Write(Logger::ZONE_ERROR, "Configuration", "Unsupported property value for " + configKey + "(" + description + "). See Documentation/Keycodes.txt for valid inputs");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
KeyMap[key] = scanCode;
|
|
||||||
retVal = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
KeyMap[key] = scanCode;
|
||||||
|
|
||||||
return retVal;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,10 @@ class UserInput
|
|||||||
public:
|
public:
|
||||||
enum KeyCode_E
|
enum KeyCode_E
|
||||||
{
|
{
|
||||||
KeyCodeNextItem,
|
KeyCodeDown,
|
||||||
KeyCodePreviousItem,
|
KeyCodeUp,
|
||||||
|
KeyCodeLeft,
|
||||||
|
KeyCodeRight,
|
||||||
KeyCodeSelect,
|
KeyCodeSelect,
|
||||||
KeyCodeBack,
|
KeyCodeBack,
|
||||||
KeyCodePageDown,
|
KeyCodePageDown,
|
||||||
|
|||||||
@@ -376,11 +376,19 @@ RetroFE::RETROFE_STATE RetroFE::ProcessUserInput(Page *page)
|
|||||||
|
|
||||||
Attract.Reset();
|
Attract.Reset();
|
||||||
|
|
||||||
if (keys[Input.GetScancode(UserInput::KeyCodePreviousItem)])
|
if (keys[Input.GetScancode(UserInput::KeyCodeUp)])
|
||||||
{
|
{
|
||||||
page->SetScrolling(Page::ScrollDirectionBack);
|
page->SetScrolling(Page::ScrollDirectionBack);
|
||||||
}
|
}
|
||||||
if (keys[Input.GetScancode(UserInput::KeyCodeNextItem)])
|
if (keys[Input.GetScancode(UserInput::KeyCodeDown)])
|
||||||
|
{
|
||||||
|
page->SetScrolling(Page::ScrollDirectionForward);
|
||||||
|
}
|
||||||
|
if (keys[Input.GetScancode(UserInput::KeyCodeLeft)])
|
||||||
|
{
|
||||||
|
page->SetScrolling(Page::ScrollDirectionBack);
|
||||||
|
}
|
||||||
|
if (keys[Input.GetScancode(UserInput::KeyCodeRight)])
|
||||||
{
|
{
|
||||||
page->SetScrolling(Page::ScrollDirectionForward);
|
page->SetScrolling(Page::ScrollDirectionForward);
|
||||||
}
|
}
|
||||||
@@ -430,8 +438,10 @@ RetroFE::RETROFE_STATE RetroFE::ProcessUserInput(Page *page)
|
|||||||
state = RETROFE_QUIT_REQUEST;
|
state = RETROFE_QUIT_REQUEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!keys[Input.GetScancode(UserInput::KeyCodePreviousItem)] &&
|
if(!keys[Input.GetScancode(UserInput::KeyCodeUp)] &&
|
||||||
!keys[Input.GetScancode(UserInput::KeyCodeNextItem)] &&
|
!keys[Input.GetScancode(UserInput::KeyCodeDown)] &&
|
||||||
|
!keys[Input.GetScancode(UserInput::KeyCodeLeft)] &&
|
||||||
|
!keys[Input.GetScancode(UserInput::KeyCodeRight)] &&
|
||||||
!keys[Input.GetScancode(UserInput::KeyCodePageUp)] &&
|
!keys[Input.GetScancode(UserInput::KeyCodePageUp)] &&
|
||||||
!keys[Input.GetScancode(UserInput::KeyCodePageDown)])
|
!keys[Input.GetScancode(UserInput::KeyCodePageDown)])
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user