diff --git a/src/InputManager.cpp b/src/InputManager.cpp index 69159c287..088990f78 100644 --- a/src/InputManager.cpp +++ b/src/InputManager.cpp @@ -58,6 +58,12 @@ void InputManager::processEvent(SDL_Event* event) case SDLK_DOWN: button = DOWN; break; + case SDLK_PAGEUP: + button = PAGEUP; + break; + case SDLK_PAGEDOWN: + button = PAGEDOWN; + break; case SDLK_RETURN: button = BUTTON1; break; diff --git a/src/InputManager.h b/src/InputManager.h index e7b544d1c..1c010580f 100644 --- a/src/InputManager.h +++ b/src/InputManager.h @@ -17,7 +17,7 @@ namespace InputManager { void loadConfig(); //enum for identifying input, regardless of configuration - enum InputButton { UNKNOWN, UP, DOWN, LEFT, RIGHT, BUTTON1, BUTTON2, MENU, SELECT}; + enum InputButton { UNKNOWN, UP, DOWN, PAGEUP, PAGEDOWN, LEFT, RIGHT, BUTTON1, BUTTON2, MENU, SELECT}; void processEvent(SDL_Event* event); diff --git a/src/components/GuiInputConfig.cpp b/src/components/GuiInputConfig.cpp index 5216e0cb5..c263c59d5 100644 --- a/src/components/GuiInputConfig.cpp +++ b/src/components/GuiInputConfig.cpp @@ -4,7 +4,7 @@ #include std::string GuiInputConfig::sConfigPath = "./input.cfg"; -std::string GuiInputConfig::sInputs[] = { "UNKNOWN", "UP", "DOWN", "LEFT", "RIGHT", "BUTTON1 (Accept)", "BUTTON2 (Back)", "START (Menu)", "SELECT (Jump-to-letter)" }; //must be same order as InputManager::InputButton enum +std::string GuiInputConfig::sInputs[] = { "UNKNOWN", "UP", "DOWN", "PAGEUP", "PAGEDOWN", "LEFT", "RIGHT", "BUTTON1 (Accept)", "BUTTON2 (Back)", "START (Menu)", "SELECT (Jump-to-letter)" }; //must be same order as InputManager::InputButton enum int GuiInputConfig::sInputCount = 9; GuiInputConfig::GuiInputConfig() diff --git a/src/components/GuiList.cpp b/src/components/GuiList.cpp index 3afedda40..bb4923f09 100644 --- a/src/components/GuiList.cpp +++ b/src/components/GuiList.cpp @@ -101,8 +101,19 @@ void GuiList::onInput(InputManager::InputButton button, bool keyDown) mScrollDir = -1; scroll(); } + if(button == InputManager::PAGEDOWN) + { + mScrollDir = 10; + scroll(); + } + + if(button == InputManager::PAGEUP) + { + mScrollDir = -10; + scroll(); + } }else{ - if((button == InputManager::DOWN && mScrollDir > 0) || (button == InputManager::UP && mScrollDir < 0)) + if((button == InputManager::DOWN && mScrollDir > 0) || (button == InputManager::PAGEDOWN && mScrollDir > 0) || (button == InputManager::UP && mScrollDir < 0) || (button == InputManager::PAGEUP && mScrollDir < 0)) { stopScrolling(); } @@ -154,9 +165,19 @@ void GuiList::scroll() mSelection += mScrollDir; if(mSelection < 0) - mSelection += mRowVector.size(); + { + if(mScrollDir == -10) + mSelection = 0; + else + mSelection += mRowVector.size(); + } if(mSelection >= (int)mRowVector.size()) - mSelection -= mRowVector.size(); + { + if(mScrollDir == 10) + mSelection = (int)mRowVector.size() - 1; + else + mSelection -= mRowVector.size(); + } if(mScrollSound) mScrollSound->play();