MenuManager::MenuManager(Logic* logic) { this->logic = logic; setupMainMenu(); setupAbout(); setupLostLife(); }
KkrEditMain::KkrEditMain(QWidget *parent) : QMainWindow(parent) { makeCoreWidgets(); setupCentralPane(); setupMainMenu(); setupDocks(); // connections connect(this, &KkrEditMain::sigNewMeta, &m_MetaData, &MetaDataManager::slCreate); connect(this, &KkrEditMain::sigNewBoard, &m_BoardData, &KkrBoardManager::slCreate); }
void setupEntities(ShaderProgram* program){ spriteSheetTexture = LoadTexture(RESOURCE_FOLDER"tiles_spritesheet2.png"); setupMainMenu(program); initPlayer(); loadChunk( createMapChunk(std::make_pair(0,0), NULL), false); loadChunk( createMapChunk(std::make_pair(1,0), NULL), false); loadChunk( createMapChunk(std::make_pair(1,1), NULL), false); loadChunk( createMapChunk(std::make_pair(0,1), NULL), false); loadChunk( createMapChunk(std::make_pair(-1,0), NULL), false); loadChunk( createMapChunk(std::make_pair(-1,-1), NULL), false); loadChunk( createMapChunk(std::make_pair(0,-1), NULL), false); loadChunk( createMapChunk(std::make_pair(1,-1), NULL), false); loadChunk( createMapChunk(std::make_pair(-1,1), NULL), false); LoadTexture(RESOURCE_FOLDER"tiles_spritesheet2.png"); }
//--------------------------------------------------------------------------- bool BaseApplication::setup(void) { mRoot = new Ogre::Root(mPluginsCfg); setupResources(); bool carryOn = configure(); if (!carryOn) return false; chooseSceneManager(); createCamera(); createViewports(); // Set default mipmap level (NB some APIs ignore this) Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5); // Create any resource listeners (for loading screens) createResourceListener(); // Load resources loadResources(); // Create the scene createScene(); createFrameListener(); SDL_Init(SDL_INIT_EVERYTHING); Mix_OpenAudio(22050,MIX_DEFAULT_FORMAT,2,4096); music = Mix_LoadMUS("Music/0/bgm2.mp3"); Mix_PlayMusic(music,-1); Mix_VolumeMusic(50); Mix_Volume(-1, 110); setupMainMenu(); mStats = new Stats(); mStopwatch = new Stopwatch(); return true; };
void BaseApplication::buttonHit(OgreBites::Button* button) { //over kill for now mTypingPassword = false; mTypingUsername = false; if(button->getName().compare("account") == 0) { removeMainMenu(); setupAccountMenu(); return; } if(button->getName().compare("create") == 0) { removeAccountMenu(); setupCreateAccountMenu(); return; } if(button->getName().compare("create uname") == 0) { mTypingUsername = true; mUsername = ""; mUsernameButton->setCaption(mUsername); return; } if(button->getName().compare("create pass") == 0) { mTypingPassword = true; mPassword = ""; mPasswordButton->setCaption(mPassword); return; } if(button->getName().compare("confirm account") == 0) { if(mUsername == "") { mMenuLabel->setCaption("Please Enter a Username"); return; } if(mPassword == "") { mMenuLabel->setCaption("Please Enter a Password"); return; } if(mStats->createAccount(mUsername, mPassword)) { mStats->save(); removeCreateAccountMenu(); setupMainMenu(); } else { mMenuLabel->setCaption("Username is Taken :("); } return; } if(button->getName().compare("back from create account") == 0) { if(!mStats->isLoggedIn()) { mUsername = ""; mPassword = ""; } removeCreateAccountMenu(); setupAccountMenu(); return; } if(button->getName().compare("login") == 0) { removeAccountMenu(); setupLoginMenu(); return; } if(button->getName().compare("login uname") == 0) { mTypingUsername = true; mUsername = ""; mUsernameButton->setCaption(mUsername); return; } if(button->getName().compare("login pass") == 0) { mTypingPassword = true; mPassword = ""; mPasswordButton->setCaption(mPassword); return; } if(button->getName().compare("login to account") == 0) { if(mUsername == "") { mMenuLabel->setCaption("Please Enter a Username"); return; } if(mPassword == "") { mMenuLabel->setCaption("Please Enter a Password"); return; } if(mStats->login(mUsername, mPassword)) { removeLoginMenu(); setupMainMenu(); } else { mMenuLabel->setCaption("Failed to Log in :("); } return; } if(button->getName().compare("back from login") == 0) { if(!mStats->isLoggedIn()) { mUsername = ""; mPassword = ""; } removeLoginMenu(); setupAccountMenu(); return; } if(button->getName().compare("logout") == 0) { mStats->logout(); mUsername = ""; mPassword = ""; removeAccountMenu(); setupAccountMenu(); return; } if(button->getName().compare("backfromsetup") == 0) { removeAccountMenu(); setupMainMenu(); return; } if(button->getName().compare("start") == 0) { removeMainMenu(); setupDifficultyMenu(); return; } else if(button->getName().compare("sound") == 0 ) { removeMainMenu(); setupSoundMenu(); return; } else if(button->getName().compare("help") == 0 ) { removeMainMenu(); setupHelpMenu(); return; } else if(button->getName().compare("helpToMain") == 0 ) { removeHelpMenu(); setupMainMenu(); return; } else if(button->getName().compare("control") == 0 ) { removeHelpMenu(); setupControlMenu(); return; } else if(button->getName().compare("back from control") == 0 ) { removeControlMenu(); setupHelpMenu(); return; } else if(button->getName().compare("info") == 0) { removeHelpMenu(); setupInfoMenu(); return; } else if(button->getName().compare("back from info") == 0 ) { removeInfoMenu(); setupHelpMenu(); return; } else if(button->getName().compare("credit") == 0) { removeMainMenu(); deleteMap(); // delete loading level mDifficulty = 5; mLevel = 1; createObjects(); mGameStart= true; mTrayMgr->hideCursor(); setupGUI(gameMap->getName()); return; } else if(button->getName().compare("quit") == 0) { removeMainMenu(); if(mStats->isLoggedIn()) { mStats->save(); } mShutDown = true; } else if(button->getName().compare("on") == 0 ) { mMusic = true; bgm = true; soundeffect =true; return; } else if(button->getName().compare("off") == 0 ) { mMusic = false; bgm = false; soundeffect =false; return; } else if(button->getName().compare("bgm on") == 0 ) { bgm = true; return; } else if(button->getName().compare("bgm off") == 0 ) { bgm = false; return; } else if(button->getName().compare("effect on") == 0 ) { soundeffect = true; return; } else if(button->getName().compare("effect off") == 0 ) { soundeffect = false; return; } else if(button->getName().compare("sound to main") == 0 ) { removeSoundMenu(); setupMainMenu(); return; } for(int x = 1; x <= Level::numDifficulties(); x++) { // for clicking on the difficulty and loading the levels if(button->getName().compare(Level::difficultyName(x)) == 0 ) { removeDifficultyMenu(); setupLevelSelect(x); return; } // for clicking back to select difficulty if(button->getName().compare("back to select difficulty " + Level::difficultyName(x)) == 0) { removeLevelSelect(x); setupDifficultyMenu(); return; } } if(button->getName().compare("back to main menu") == 0 ) { removeDifficultyMenu(); setupMainMenu(); return; } for(int x = 1; x <= Level::numDifficulties(); x++) { for(int y = 1; y <= Level::numLevels(x); y++) { std::string name = Level::difficultyName(x) + " " + patch::to_string(y); if(button->getName().compare(name) == 0) { removeLevelSelect(x); deleteMap(); mDifficulty =x; mLevel = y; createObjects(); mGameStart = true; mTrayMgr->hideCursor(); setupGUI(gameMap->getName()); return; } } } if(button->getName().compare("quit level") == 0 ) { removeLevelMenu(); deleteMap(); mGameStart = false; setupMainMenu(); levelLoaded = false; music = Mix_LoadMUS("Music/0/bgm2.mp3"); Mix_PlayMusic(music,-1); if(mStats->isLoggedIn()) { mStats->update(mDifficulty, mLevel, mDeathCounter, mStopwatch->elapsedTime(), false); } mStopwatch->reset(); mDeathCounter = 0; return; } else if(button->getName().compare("resume level") == 0 ) { removeLevelMenu(); setupGUI(gameMap->getName()); mStopwatch->unpause(); return; } else if(button->getName().compare("surrender") == 0 ) { removeDeathMenu(); deleteMap(); mGameStart = false; setupMainMenu(); levelLoaded = false; music = Mix_LoadMUS("Music/0/bgm2.mp3"); Mix_PlayMusic(music,-1); if(mStats->isLoggedIn()) { mStats->update(mDifficulty, mLevel, mDeathCounter+1, mStopwatch->elapsedTime(), false); } mStopwatch->reset(); mDeathCounter = 0; //SAVE AND LOAD return; } else if(button->getName().compare("better") == 0 ) { mCanRespawn = false; removeDeathMenu(); setupGUI(gameMap->getName()); gameMap->respawn(); mDeathCounter += 1; if(mDeathCounter == 1) { mNumDeaths->setCaption(patch::to_string(mDeathCounter) + " death"); } else { mNumDeaths->setCaption(patch::to_string(mDeathCounter) + " deaths"); } mTrayMgr->hideCursor(); return; } }