Made changes after testing. Support option to use up/down if left/right is not configured (and vice versa).

This commit is contained in:
emb
2015-03-03 12:31:39 -06:00
parent 79b4a7e3de
commit fa5f425743
4 changed files with 31 additions and 36 deletions

View File

@@ -33,19 +33,19 @@ bool UserInput::Initialize()
if(!MapKey("up", KeyCodeUp))
{
retVal = MapKey("previousItem", KeyCodeUp) && retVal;
retVal = MapKey("left", KeyCodeUp) && retVal;
}
if(!MapKey("left", KeyCodeLeft))
{
retVal = MapKey("previousItem", KeyCodeLeft) && retVal;
retVal = MapKey("up", KeyCodeLeft) && retVal;
}
if(!MapKey("down", KeyCodeDown))
{
retVal = MapKey("nextItem", KeyCodeDown) && retVal;
retVal = MapKey("right", KeyCodeDown) && retVal;
}
if(!MapKey("right", KeyCodeRight))
{
retVal = MapKey("nextItem", KeyCodeRight) && retVal;
retVal = MapKey("down", KeyCodeRight) && retVal;
}
retVal = MapKey("pageDown", KeyCodePageDown) && retVal;
@@ -76,7 +76,6 @@ SDL_Scancode UserInput::GetScancode(KeyCode_E key)
bool UserInput::MapKey(std::string keyDescription, KeyCode_E key)
{
bool retVal = false;
SDL_Scancode scanCode;
std::string description;
@@ -85,22 +84,18 @@ bool UserInput::MapKey(std::string keyDescription, KeyCode_E key)
if(!Config.GetProperty(configKey, description))
{
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());
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;
}
Logger::Write(Logger::ZONE_ERROR, "Configuration", "Unsupported property value for " + configKey + "(" + description + "). See Documentation/Keycodes.txt for valid inputs");
return false;
}
return retVal;
KeyMap[key] = scanCode;
return true;
}

View File

@@ -580,7 +580,7 @@ ScrollingList * PageBuilder::BuildMenu(xml_node<> *menuXml)
xml_attribute<> *menuTypeXml = menuXml->first_attribute("type");
xml_attribute<> *scrollTimeXml = menuXml->first_attribute("scrollTime");
xml_attribute<> *scrollAccelerationXml = menuXml->first_attribute("scrollAcceleration");
xml_attribute<> *scrollOrientationXml = menuXml->first_attribute("scrollOrientation");
xml_attribute<> *scrollOrientationXml = menuXml->first_attribute("orientation");
if(menuTypeXml)
{

View File

@@ -378,7 +378,7 @@ RetroFE::RETROFE_STATE RetroFE::ProcessUserInput(Page *page)
Attract.Reset();
if(page->IsHorizontalScroll())
if(page->IsHorizontalScroll())
{
if (keys[Input.GetScancode(UserInput::KeyCodeLeft)])
{
@@ -386,30 +386,30 @@ RetroFE::RETROFE_STATE RetroFE::ProcessUserInput(Page *page)
}
if (keys[Input.GetScancode(UserInput::KeyCodeRight)])
{
page->SetScrolling(Page::ScrollDirectionForward);
page->SetScrolling(Page::ScrollDirectionForward);
}
}
else
{
if (keys[Input.GetScancode(UserInput::KeyCodeUp)])
{
page->SetScrolling(Page::ScrollDirectionBack);
}
if (keys[Input.GetScancode(UserInput::KeyCodeDown)])
{
page->SetScrolling(Page::ScrollDirectionForward);
page->SetScrolling(Page::ScrollDirectionForward);
}
}
else
{
if (keys[Input.GetScancode(UserInput::KeyCodePageUp)])
{
page->PageScroll(Page::ScrollDirectionBack);
}
if (keys[Input.GetScancode(UserInput::KeyCodePageDown)])
{
page->PageScroll(Page::ScrollDirectionForward);
}
}
if (keys[Input.GetScancode(UserInput::KeyCodeAdminMode)])
{
if (keys[Input.GetScancode(UserInput::KeyCodePageUp)])
{
page->PageScroll(Page::ScrollDirectionBack);
}
if (keys[Input.GetScancode(UserInput::KeyCodePageDown)])
{
page->PageScroll(Page::ScrollDirectionForward);
}
if (keys[Input.GetScancode(UserInput::KeyCodeAdminMode)])
{
//todo: add admin mode support
}
if (keys[Input.GetScancode(UserInput::KeyCodeSelect)])