Changeset 11046
- Timestamp:
- Jan 5, 2016, 11:18:27 AM (9 years ago)
- Location:
- code/branches/presentationHS15
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentationHS15/data/gui/scripts/SheetManager.lua
r8729 r11046 24 24 cursor:show() 25 25 end 26 end 27 28 function getLoadedSheets() 29 local names = "" 30 for name, sheet in pairs(loadedSheets) do 31 names = names .. name 32 names = names .. "," 33 end 34 return names 26 35 end 27 36 -
code/branches/presentationHS15/src/libraries/core/GUIManager.cc
r10624 r11046 36 36 #include <OgreRenderWindow.h> 37 37 38 extern "C" { 39 #include <lua.h> 40 } 41 38 42 #if CEGUI_VERSION >= 0x000800 39 43 # include <CEGUI/DefaultLogger.h> … … 251 255 /*static*/ const std::string GUIManager::defaultScheme_ = "TaharezGreen"; //Alternative: Orxonox (not fully complete yet, see the graphics menu) 252 256 253 SetConsoleCommand("showGUI", &GUIManager::showGUI).defaultValue(1, false).defaultValue(2, false); 254 SetConsoleCommand("hideGUI", &GUIManager::hideGUI); 255 SetConsoleCommand("toggleGUI", &GUIManager::toggleGUI).defaultValue(1, false).defaultValue(2, false); 257 namespace autocompletion 258 { 259 /** 260 @brief Returns the names of all currently existing OverlayGroups. 261 */ 262 ARGUMENT_COMPLETION_FUNCTION_DECLARATION(guinames)(); 263 ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(guinames)() 264 { 265 ArgumentCompletionList names; 266 const std::vector<std::string> guis = GUIManager::getInstance().getLoadedGUIs(); 267 for (size_t i = 0; i < guis.size(); ++i) 268 names.push_back(ArgumentCompletionListElement(guis[i], getLowercase(guis[i]))); 269 return names; 270 } 271 } 272 273 SetConsoleCommand("showGUI", &GUIManager::showGUI).defaultValue(1, false).defaultValue(2, false) 274 .argumentCompleter(0, autocompletion::guinames()); 275 SetConsoleCommand("hideGUI", &GUIManager::hideGUI) 276 .argumentCompleter(0, autocompletion::guinames()); 277 SetConsoleCommand("toggleGUI", &GUIManager::toggleGUI).defaultValue(1, false).defaultValue(2, false) 278 .argumentCompleter(0, autocompletion::guinames()); 256 279 257 280 RegisterAbstractClass(GUIManager).inheritsFrom<WindowEventListener>(); … … 489 512 { 490 513 this->luaState_->doString(str, rootFileInfo_); 514 } 515 516 std::vector<std::string> GUIManager::getLoadedGUIs() 517 { 518 // TODO: is there a better way to read back a return value from lua? i.e. by using LuaState? 519 lua_State* L = this->luaState_->getInternalLuaState(); 520 521 // push function 522 lua_getglobal(L, "getLoadedSheets"); 523 524 // do the call (0 arguments, 1 result) 525 if (lua_pcall(L, 0, 1, 0) != 0) 526 orxout(internal_error) << "error running function: " << lua_tostring(L, -1) << endl; 527 528 // retrieve result 529 if (!lua_isstring(L, -1)) 530 orxout(internal_error) << "function must return a string" << endl; 531 std::string value = lua_tostring(L, -1); 532 lua_pop(L, 1); 533 534 SubString tokens(value, ","); 535 return tokens.getAllStrings(); 491 536 } 492 537 -
code/branches/presentationHS15/src/libraries/core/GUIManager.h
r9675 r11046 107 107 void preUpdate(const Clock& time); 108 108 109 std::vector<std::string> getLoadedGUIs(); 110 109 111 void loadGUI(const std::string& name); 110 112 static void showGUI(const std::string& name, bool bHidePrevious = false, bool bNoInput = false);
Note: See TracChangeset
for help on using the changeset viewer.