Changeset 8078 for code/branches/usability
- Timestamp:
- Mar 15, 2011, 9:09:58 PM (14 years ago)
- Location:
- code/branches/usability
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/usability/data/defaultConfig/keybindings.ini
r8035 r8078 19 19 KeyDelete="scale 1 rotateRoll" 20 20 KeyDivide= 21 KeyDown="scale -1 moveFrontBack | navigateGUI down"21 KeyDown="scale -1 moveFrontBack" 22 22 KeyE="scale -1 rotateRoll" 23 23 KeyEnd=boost … … 52 52 KeyKanji= 53 53 KeyL= 54 KeyLeft="scale -1 moveRightLeft | navigateGUI left"54 KeyLeft="scale -1 moveRightLeft" 55 55 KeyLeftAlt= 56 56 KeyLeftBracket= … … 93 93 KeyNumpadAdd= 94 94 KeyNumpadComma= 95 KeyNumpadEnter= "navigateGUI enter"95 KeyNumpadEnter= 96 96 KeyNumpadEquals= 97 97 KeyNumpadPeriod= … … 108 108 KeyQ="scale 1 rotateRoll" 109 109 KeyR="scale 1 moveUpDown" 110 KeyReturn= "navigateGUI enter"111 KeyRight="scale 1 moveRightLeft | navigateGUI right"110 KeyReturn= 111 KeyRight="scale 1 moveRightLeft" 112 112 KeyRightAlt= 113 113 KeyRightBracket= … … 126 126 KeyTab="NewHumanController changeMode" 127 127 KeyU="" 128 KeyUP="scale 1 moveFrontBack | navigateGUI up"128 KeyUP="scale 1 moveFrontBack" 129 129 KeyUnassigned="InGameConsole openConsole" 130 130 KeyUnderline= -
code/branches/usability/data/gui/scripts/GUISheet.lua
r8035 r8078 29 29 30 30 -- Override this function if you want to react on keystrokes 31 function P:onKeyPressed( mode)31 function P:onKeyPressed() 32 32 end 33 33 … … 85 85 86 86 -- Handles key pressed while the gui sheed is displayed 87 function P:keyPressed( mode)87 function P:keyPressed() 88 88 if self.buttons then 89 if mode == "down" then -- key down89 if code == "208" then -- key down 90 90 self:moveSelectionRow(1) 91 elseif mode == "up" then -- key up91 elseif code == "200" then -- key up 92 92 self:moveSelectionRow(-1) 93 elseif mode == "right" then -- key right93 elseif code == "205" then -- key right 94 94 self:moveSelectionColumn(1) 95 elseif mode == "left" then -- key left95 elseif code == "203" then -- key left 96 96 self:moveSelectionColumn(-1) 97 elseif mode == "enter"then -- key enter or key numpad enter97 elseif code == "28" or code == "156" then -- key enter or key numpad enter 98 98 self:pressSelectedButton() 99 99 end 100 100 end 101 101 102 self:onKeyPressed( mode)102 self:onKeyPressed() 103 103 end 104 104 -
code/branches/usability/data/gui/scripts/GraphicsMenu.lua
r8035 r8078 1 1 -- GraphicsMenu.lua 2 2 3 local P = createMenuSheet("GraphicsMenu" , true, TriBool.True, TriBool.True)3 local P = createMenuSheet("GraphicsMenu") 4 4 5 5 P.resolutionList = {"custom", "640 x 480", "720 x 480", "720 x 576", "800 x 600", "1024 x 600", "1024 x 768", "1152 x 864", "1280 x 720", "1280 x 800", "1280 x 960", "1280 x 1024", "1360 x 768", "1440 x 900", "1600 x 900", "1600 x 1200", "1680 x 1050"} -
code/branches/usability/data/gui/scripts/MenuSheet.lua
r8035 r8078 16 16 newSheet.bHidePrevious = handleDefArg(_bHidePrevious, true) 17 17 newSheet.tShowCursor = handleDefArg(_tShowCusor, TriBool.True) 18 newSheet.tUseKeyboard = handleDefArg(_tUseKeyboard, TriBool. Dontcare)18 newSheet.tUseKeyboard = handleDefArg(_tUseKeyboard, TriBool.True) 19 19 newSheet.bBlockJoyStick = handleDefArg(_bBlockJoyStick, false) 20 20 -
code/branches/usability/data/gui/scripts/SheetManager.lua
r8035 r8078 5 5 local activeMenuSheets = {size = 0, topSheetTuple = nil} 6 6 local menuSheetsRoot = guiMgr:getMenuRootWindow() 7 local bInGameConsoleClosed = false 7 8 local mainMenuLoaded = false 8 --orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "KeyDown", "keyPressed")9 orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "KeyDown", "keyPressed") 9 10 orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "Sized", "windowResized") 10 11 … … 131 132 if previous and previous.pressedEnter and menuSheet:hasSelection() == false then 132 133 menuSheet:setSelectionNear(1, 1) 133 end134 135 if activeMenuSheets.size > 0 then136 guiMgr:guisActiveChanged(true)137 134 end 138 135 … … 207 204 end 208 205 209 if activeMenuSheets.size == 0 then210 guiMgr:guisActiveChanged(false)211 end212 213 206 sheetTuple.sheet:quit() 214 207 end … … 224 217 -- HUGE, very HUGE hacks! 225 218 226 -- Count the number of sheets that don't need input until the first that does. 219 -- If the InGameConsole is active, ignore the ESC command. 220 if bInGameConsoleClosed == true then 221 bInGameConsoleClosed = false 222 return 223 end 224 225 -- Count the number of sheets that don't need input till the first that does. 227 226 local counter = noInputSheetIndex() 228 227 … … 238 237 end 239 238 240 -- Function to navigate the GUI, is called by the GUIManager, whenever a relevant key is pressed. 241 -- The mode specifies the action to be taken. 242 function navigateGUI(mode) 239 function keyPressed(e) 240 local we = tolua.cast(e, "CEGUI::KeyEventArgs") 243 241 local sheet = activeMenuSheets[activeMenuSheets.size] 244 sheet.sheet:keyPressed(mode) 242 code = tostring(we.scancode) 243 -- Some preprocessing 244 if not mainMenuLoaded and not sheet.bNoInput then 245 if code == "1" then 246 keyESC() 247 elseif code == "0"then 248 orxonox.CommandExecutor:execute("InGameConsole openConsole") 249 end 250 end 251 sheet.sheet:keyPressed() 245 252 end 246 253 … … 286 293 end 287 294 return counter 295 end 296 297 function inGameConsoleClosed() 298 bInGameConsoleClosed = not bInGameConsoleClosed; 288 299 end 289 300 -
code/branches/usability/src/libraries/core/GUIManager.cc
r8035 r8078 103 103 /*static*/ const std::string GUIManager::defaultScheme_ = "TaharezGreen"; 104 104 105 static const std::string __CC_navigateGUI_name = "navigateGUI";106 107 105 SetConsoleCommand("showGUI", &GUIManager::showGUI).defaultValue(1, false).defaultValue(2, false); 108 106 SetConsoleCommand("hideGUI", &GUIManager::hideGUI); 109 107 SetConsoleCommand("toggleGUI", &GUIManager::toggleGUI).defaultValue(1, false).defaultValue(2, false); 110 SetConsoleCommand(__CC_navigateGUI_name, &GUIManager::navigateGUI).deactivate();111 112 //! Strings that specify modes for the GUI navigation.113 /*static*/ const std::string GUIManager::NAVIGATE_UP = "up";114 /*static*/ const std::string GUIManager::NAVIGATE_DOWN = "down";115 /*static*/ const std::string GUIManager::NAVIGATE_LEFT = "left";116 /*static*/ const std::string GUIManager::NAVIGATE_RIGHT = "right";117 /*static*/ const std::string GUIManager::NAVIGATE_ENTER = "enter";118 108 119 109 /** … … 374 364 this->rootWindow_->setProperty("Alpha", "1.0"); 375 365 this->rootWindow_->setProperty("Image", image); 376 }377 378 /**379 @brief380 Method to navigate the GUI, by specifying the mode of navigation.381 @param mode382 The mode of navigation, at this point can be either 'up', 'down', 'left', 'right' or 'enter'.383 */384 /*static*/ void GUIManager::navigateGUI(const std::string& mode)385 {386 if(mode == NAVIGATE_UP)387 GUIManager::getInstance().executeCode("navigateGUI(\"" + NAVIGATE_UP + "\")");388 else if(mode == NAVIGATE_DOWN)389 GUIManager::getInstance().executeCode("navigateGUI(\"" + NAVIGATE_DOWN + "\")");390 else if(mode == NAVIGATE_LEFT)391 GUIManager::getInstance().executeCode("navigateGUI(\"" + NAVIGATE_LEFT + "\")");392 else if(mode == NAVIGATE_RIGHT)393 GUIManager::getInstance().executeCode("navigateGUI(\"" + NAVIGATE_RIGHT + "\")");394 else if(mode == NAVIGATE_ENTER)395 GUIManager::getInstance().executeCode("navigateGUI(\"" + NAVIGATE_ENTER + "\")");396 }397 398 /**399 @brief400 Is called by lua to change whether there are any GUIs active at the moment.401 @param active402 Whether GUIs are active.403 */404 void GUIManager::guisActiveChanged(bool active)405 {406 if(this->GUIsActive_ == active)407 return;408 this->GUIsActive_ = active;409 if(this->GUIsActive_)410 ModifyConsoleCommand(__CC_navigateGUI_name).activate();411 else412 ModifyConsoleCommand(__CC_navigateGUI_name).deactivate();413 366 } 414 367 -
code/branches/usability/src/libraries/core/GUIManager.h
r8040 r8078 95 95 void setBackgroundImage(const std::string& image); 96 96 97 static void navigateGUI(const std::string& mode);98 void guisActiveChanged(bool active); // tolua_export99 100 97 /** 101 98 @brief Helper method to get the developer's mode without having to export Core.h. … … 134 131 template <typename FunctionType> 135 132 bool protectedCall(FunctionType function); 136 137 static const std::string NAVIGATE_UP;138 static const std::string NAVIGATE_DOWN;139 static const std::string NAVIGATE_LEFT;140 static const std::string NAVIGATE_RIGHT;141 static const std::string NAVIGATE_ENTER;142 143 bool GUIsActive_; //!< Whether there are any GUIs active at a given moment.144 133 145 134 // keyHandler functions -
code/branches/usability/src/orxonox/gamestates/GSMainMenu.cc
r8035 r8078 68 68 RegisterRootObject(GSMainMenu); 69 69 70 InputManager::getInstance().createInputState("MainMenuHackery" )->setKeyHandler(KeyBinderManager::getInstance().getDefaultAsHandler());70 InputManager::getInstance().createInputState("MainMenuHackery", true, true)->setKeyHandler(KeyBinderManager::getInstance().getDefaultAsHandler()); 71 71 72 72 // create an empty Scene -
code/branches/usability/src/orxonox/overlays/InGameConsole.cc
r8035 r8078 49 49 #include "core/ConfigValueIncludes.h" 50 50 #include "core/command/ConsoleCommand.h" 51 #include "core/GUIManager.h" 51 52 #include "core/input/InputManager.h" 52 53 #include "core/input/InputState.h" … … 533 534 { 534 535 this->bActive_ = false; 536 GUIManager::getInstance().getLuaState()->doString("inGameConsoleClosed()"); // Notify the SheetManager in lua, that the console has been closed. 535 537 InputManager::getInstance().leaveState("console"); 536 538 this->shell_->unregisterListener(this); … … 609 611 /*static*/ void InGameConsole::closeConsole() 610 612 { 613 GUIManager::getInstance().getLuaState()->doString("inGameConsoleClosed()"); // Notify the SheetManager in lua, that the console has been closed, but not by ESC. 611 614 InGameConsole::getInstance().deactivate(); 612 615 }
Note: See TracChangeset
for help on using the changeset viewer.