int main() { MainMenu mainmenu; mainmenu.display(); return 0; }
void ItemScene::mousePressEvent(QGraphicsSceneMouseEvent *event) { if(this->sceneType == MenuDisplay) { cout << "Width: " << this->sceneRect().width() << endl; QList<QGraphicsView*> parentViews = this->views(); cout << parentViews.size() << endl; MainMenu* view = (MainMenu*)parentViews.at(0); int viewPosX, viewPosY, viewWidth, viewHeight, imagePosX, imagePosY, imageWidth, imageHeight; viewPosX = view->getPosition()->x(); viewPosY = view->getPosition()->y(); viewWidth = view->width(); viewHeight = view->height(); imagePosX = this->imageDisplay->imageFileItem->pos().x(); imagePosY = this->imageDisplay->imageFileItem->pos().y(); imageWidth = this->imageDisplay->imageFileItem->boundingRect().width(); imageHeight = this->imageDisplay->imageFileItem->boundingRect().height(); if( (viewPosX + viewWidth >= imagePosX || viewPosX + viewWidth >= imagePosX + imageWidth ) && (viewPosY <= imagePosY || viewPosY <= imagePosY + imageHeight) ) { QPointF position(viewPosX + event->scenePos().x(), viewPosY + event->scenePos().y()); this->imageDisplay->addSelectionMarker(position); } } update(); QGraphicsScene::mousePressEvent(event); }
void MainWindow::on_btnLogin_clicked() { QSqlQueryModel *model = new QSqlQueryModel; model->setQuery("SELECT * FROM users"); model->setHeaderData(0, Qt::Horizontal, tr("Name")); model->setHeaderData(0, Qt::Horizontal, tr("Password")); model->setHeaderData(0, Qt::Horizontal, tr("Type")); QString username = ui->txtUserName->text(); QString password = ui->txtPassWord->text(); bool success = loginManager->Login(username, password); if (success) { MainMenu *menu = new MainMenu(0, loginManager); menu->show(); this->destroy(); //QTableView *view = new QTableView; //view->setWindowTitle("Users"); //view->resizeColumnsToContents(); //view->resizeRowsToContents(); //view->setModel(model); //view->show(); //view->resize(640, 480); } }
void Game::initializeGame() { std::cout<<"\n\n BOOT UP: LOADING SPRITES: "; //Loading Text MainMenu* MenuState = new MainMenu(); MenuState->Init(this); states.push_back(MenuState); LevelHome* StateHome = new LevelHome(); StateHome->Init(this); states.push_back(StateHome); LevelOne* StateOne = new LevelOne(); StateOne->Init(this); states.push_back(StateOne); LevelTwo* StateTwo = new LevelTwo(); StateTwo->Init(this); states.push_back(StateTwo); LevelThree* StateThree = new LevelThree(); StateThree->Init(this); states.push_back(StateThree); UIState* UI = new UIState(); UI->Init(this); states.push_back(UI); MessageState* Msg = new MessageState(); Msg->Init(this); states.push_back(Msg); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); MainMenu w; w.show(); return a.exec(); }
void MainMenu::on_pushButton_4_clicked() { MainMenu *m = DataModel::getMainmenu(); m->hide(); collectionGUI *c = DataModel::getCollectiongui(); c->show(); }
int main() { MainMenu start; start.initComponents(); start.run(); return 0; }
int main() { //Declare Variables char wasd = ' '; // Holds player's movement char *loc = 0; // Holds player location char **arrMap1; // For allocating memory int locX = 0; // Holds X location int locY = 0; // Holds Y location int turn = 0; // Holds turns taken int menuIn = 0; // Holds menu input int debug[0]; // Converts char to int for debug file bool isGameRunning = true; // Checks if game is still running bool action = false; // Checks if player is fighting //Define objects Player p; Map map1; MainMenu menu; //Allocate instances Speechbox *sB = new Playerbox(); Playerbox *pB = new Playerbox(); Pickupbox *pU = new Pickupbox(); //Build FileStream object FileStream f; //Display menu and prompt for choice f.readFile("Main.mnu", 0, 0); cin >> menuIn; //If 3, display help screen if(menuIn == 3) { system("cls"); f.readFile("help.mnu", 0, 0); cout << "\nPress Enter to start game\n"; _getch(); system("cls"); } //If 4, exit and don,t bother set or output else if(menuIn == 4){ cout << "\nGoodbye!\n"; exit(EXIT_SUCCESS); } //If not 3, set and output menu menu.setInN(menuIn); menu.outMenu(menuIn); //If load game fail, prompt if(menu.getIsCodeGood() == false) { //Prompt for user info cin >> p; //Prompt for map properties cin >> map1; }
void init() { stack_position = StackPosition::CENTERED; init_random(); input.init(); init_modes(); init_textures(); menu.init(); menu.init_graphics(); }
void GameScene::Update(void * params, Game * game) { game->keyboard.UpdateState(); if(game->keyboard.IsKeyPressed(SDLK_y)) character.NextAnimation(); if(game->keyboard.IsKeyPressed(SDLK_w)) character.SetCurrentDirection(0); if(game->keyboard.IsKeyPressed(SDLK_s)) character.SetCurrentDirection(1); if(game->keyboard.IsKeyPressed(SDLK_a)) character.SetCurrentDirection(2); if(game->keyboard.IsKeyPressed(SDLK_d)) character.SetCurrentDirection(3); if(game->keyboard.IsKeyDown(SDLK_q)) game->Kill(); if(game->keyboard.IsKeyPressed(SDLK_ESCAPE)) { MainMenu * menu = new MainMenu(); menu->AddMenuItem("Quit"); menu->AddMenuItem("Continue"); game->PushScene(menu); } if(game->keyboard.IsKeyDown(SDLK_RIGHT)) { currentBackground.Move(-1.0f,0.0f); character.SetCurrentDirection(3); character.StepAnimation(); } if(game->keyboard.IsKeyDown(SDLK_LEFT)) { currentBackground.Move(1.0f,0.0f); character.SetCurrentDirection(2); character.StepAnimation(); } if(game->keyboard.IsKeyDown(SDLK_UP)) { currentBackground.Move(0.0f,1.0f); character.SetCurrentDirection(0); character.StepAnimation(); } if(game->keyboard.IsKeyDown(SDLK_DOWN)) { currentBackground.Move(0.0f,-1.0f); character.SetCurrentDirection(1); character.StepAnimation(); } }
int main() { // this outputs the title of the app // and initialises the MathsOp pointer declared privately // an example of multitasking for the programmer MainMenu *mainMenu = new MainMenu(); mainMenu->showOptions(); // free resources allocated dynamically delete mainMenu; return 0; }
/*--------------------------------------------------------------------------*/ void PegAppInitialize(PegPresentationManager *pPresent) { printf("err0\n"); pPresent->Screen()->SetPalette(0, 255, PegCustomPalette); /* use custom palette */ pPresent->SetColor(PCI_NORMAL, NEWMENU_BACKGRANOUD_COLOR); printf("error1\n"); pPresent->Draw(); printf("error2\n"); /*Set default font size (only English)*/ PegTextThing::SetDefaultFont(PEG_PROMPT_FONT,&Arial14); PegTextThing::SetDefaultFont(PEG_TBUTTON_FONT,&Arial12); //gbCurrentLanguage = 1; /* if(0 == gbCurrentLanguage) { PegTextThing::SetDefaultFont(PEG_PROMPT_FONT,&Arial14); PegTextThing::SetDefaultFont(PEG_TBUTTON_FONT,&Arial12); } else if(1 == gbCurrentLanguage) { PegTextThing::SetDefaultFont(PEG_PROMPT_FONT,&heiti14); PegTextThing::SetDefaultFont(PEG_TBUTTON_FONT,&heiti12); } */ printf("error3\n"); MainMenu *pWin = new MainMenu(20, 20); printf("error4\n"); ToolTip * pToolTip = new ToolTip(0, 0, NULL); pWin->SetToolTipWnd(pToolTip); printf("err111\n"); TVHelpWnd * pTVHelpWnd = new TVHelpWnd(pWin->mReal.wLeft + 400, pWin->mReal.wTop); pWin->SetHelpWnd(pTVHelpWnd); /*set translucency*/ pPresent->Add(pTVHelpWnd); pPresent->Add(pToolTip, FALSE); pPresent->Add(pWin); pWin->ProcessUpDownKey(); PegMessage tmpMsg; tmpMsg.pTarget = pToolTip; tmpMsg.pSource = pPresent; tmpMsg.wType = PM_SHOW; pPresent->Message(tmpMsg); }
void Game::ShowMenu() { MainMenu mainMenu; MainMenu::MenuResult result=mainMenu.Show(_mainWindow); if(result == MainMenu::Exit) { _gameState = Game::Exiting; } if(result == MainMenu::newGame) { _gameState = Game::newGame; } if(result == MainMenu::joinGame) { _gameState = Game::joinGame; } }
int main(int argc, char *argv[]) { QApplication a(argc, argv); MainMenu w; QRect screenGeometry = QApplication::desktop()->screenGeometry(); int x = (screenGeometry.width()-w.width()) / 2; int y = (screenGeometry.height()-w.height()) / 2; w.move(x, y); w.show(); return a.exec(); }
void MainMenuBase::execSyncV( FieldContainer &oFrom, ConstFieldMaskArg whichField, AspectOffsetStore &oOffsets, ConstFieldMaskArg syncMode, const UInt32 uiSyncInfo) { MainMenu *pThis = static_cast<MainMenu *>(this); pThis->execSync(static_cast<MainMenu *>(&oFrom), whichField, oOffsets, syncMode, uiSyncInfo); }
int main(int argc, char* argv[]) { if(argc > 1) { // TODO we should have cla's for testing purposes } // Creats the main menu to start the game MainMenu menu; // Displays main menu do print_menu_clr("screen_main"); while (!menu.get_input()); return 0; }
void Game::ShowMenu() { MainMenu mainMenu; MainMenu::MenuResult result = mainMenu.show(m_mainWindow); switch(result) { case MainMenu::Exit: m_gameState = Game::Exiting; break; case MainMenu::Play: m_gameState = Game::Playing; break; } }
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR, int nCmdShow) { #if defined(DEBUG) || defined(_DEBUG) myInitMemoryCheck(); #endif //_CrtSetBreakAlloc(3795052); MaloW::ClearDebug(); GraphicsEngineParams params; params.LoadFromeFile("config.cfg"); //params.CamType = FPS; /* Structure of cfg file: windowWidth windowHeight Maximized ShadowMapQuality FXAAQuality */ GameOptions GameParams; GameParams.LoadFromeFile("GameSettings.cfg"); /* masterVolume songVolume //Funkar dock inte effectVolume //Funkar dock inte */ // Create the graphics engine GraphicsEngine* ge = new GraphicsEngine(params, hInstance, nCmdShow); gfxeng::eng = ge; // Set the global eng to our engine so that GetGraphicsEngine(); can work. ge->CreateSkyBox("Media/skymap.dds"); //test(); // Instead of ifndef lol // Create the MainMenu and send the graphics engine, and then run Run(); MainMenu* mm = new MainMenu(ge); mm->Run(); delete mm; delete ge; gfxeng::eng = NULL; #if defined(DEBUG) || defined(_DEBUG) myDumpMemoryLeaks(); #endif return 0; }
void LoginWindow::on_loginButton_clicked() { ui->statusBar->showMessage(loggingIn.c_str()); SystemUser user = {ui->usernameLineEdit->text().toStdString(), ui->passwordLineEdit->text().toStdString()}; if (Login(user)) { ui->statusBar->clearMessage(); this->setHidden(true); MainMenu *mainMenu = new MainMenu(this, user); connect(mainMenu, SIGNAL(UserLoggedOut()), this, SLOT(UserLoggedOut())); mainMenu->show(); } else if (ui->statusBar->currentMessage().toStdString() != connectionError) ui->statusBar->showMessage(loginFailed.c_str()); }
int main(int argc, char **argv) { QApplication app(argc, argv); QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); MainMenu main; main.setFixedSize(320, 240); main.setWindowFlags(Qt::CustomizeWindowHint); main.show(); return app.exec(); }
MainMenu* MainMenu::create() { MainMenu *pRet = new MainMenu(); if (pRet && pRet->init()) { pRet->autorelease(); return pRet; } else { delete pRet; pRet = NULL; return NULL; } }
void Draw(Core::Graphics& graphics){ if (isEditingSpaceship){ editor.Draw(graphics); } else{ graphics.SetColor(defaultColor); if(!isMainMenu && !isControls){ { PROFILE("LevelDraw"); lvl.Draw(graphics); } { PROFILE("ParticlesDraw"); manager->Draw(graphics); } } else if (isControls){ Controls::Draw(graphics); } else{ menu.Draw(graphics); } } Debug::DrawMemoryState(graphics, SCREEN_HEIGHT); }
msg_t UI::run(void * nothing){ MainMenu menu; button[0].enable(); button[1].enable(); button[2].enable(); button[0].clear_callbacks(); button[1].clear_callbacks(); button[2].clear_callbacks(); button[0].set_press_handler((button_t::button_handler)handle_right, nullptr); button[1].set_press_handler((button_t::button_handler)handle_select, nullptr); button[2].set_press_handler((button_t::button_handler)handle_left, nullptr); start_suspend_timer(); menu.exec(); return 0; }
void UpdateGameState(){ if (isMainMenu){ int menuChoice = menu.GetSelectedItem(); if (menuChoice == START_GAME){ ResetLevel(); menu.Reset(); isMainMenu = false; } else if (menuChoice == CONTROLS){ isControls = true; ResetLevel(); menu.Reset(); isMainMenu = false; } } }
MainMenu* MainMenu::create(MainMenuController* controller) { MainMenu* mainMenu = NULL; do { mainMenu = new MainMenu(controller); BREAK_IF(!mainMenu->mController); // ensure we have a controller, there will be no other opportunity to attach one. BREAK_IF(!mainMenu); // Out of memory BREAK_IF(!mainMenu->setup()); // Our layout depends on this existing. mainMenu->initialize(); // Woo hoo, we made it. Go layout. return mainMenu; } while (false); cerr << " Could not create main menu.\n"; if(mainMenu) { mainMenu->release(); } return NULL; }
int main(int argc, char *argv[]) { DataConnect data; data.getDataFromDatabase(); data.getBorrDataFromDatabaseNew(); data.getCollDataFromDatabase(); QApplication a(argc, argv); DataModel::init(); MainMenu *m = DataModel::getMainmenu(); m->show(); // MainWindow *m = DataModel::getMainwindow(); // m->show(); return a.exec(); }
OptionsMenu::OptionsMenu(MainMenu& mainMenu): Scene(mainMenu.app()), mainMenu(mainMenu), inited(false), cursor(NULL), backText(NULL), interpolatedText(NULL), wireframeText(NULL), texturedText(NULL), useVSyncText(NULL), gameSpeedText(NULL), lightColorText(NULL), lightDirectionText(NULL) { }
int main() { //create main menu MainMenu menu; //add main menu buttons menu.addButton(new Start(sf::Vector2f(100, 100), true)); menu.addButton(new Credit(sf::Vector2f(100, 200))); sf::RenderWindow window; sf::VideoMode desktopMode = sf::VideoMode::getDesktopMode(); window.create(sf::VideoMode(WINDOWX, WINDOWY), "ex1"); //start the game menu.stratGame(window); return EXIT_SUCCESS; }
void WindowManager::ProcessEvent(SDL_Event *event) { MainMenu *mainmenu = (MainMenu *)SM->GetSceneByName("Main Menu"); OptionsMenu *optionsmenu = (OptionsMenu *)SM->GetSceneByName("Options Menu"); switch(event->type) // See which event it is { // When window is resized or is toggled between window and fullscreen case SDL_VIDEORESIZE: //Cleanup(); InitOpenGL(); IsGLErrors("Video Resize"); if(!WM->IsFullscreen()) { SetWindowedMode(0, 0, event->resize.w, event->resize.h); } glViewport(0,0,event->resize.w,event->resize.h); // Resize OpenGL Viewport to fit the screen/window SM->InitAll(); break; // When user quits the game case SDL_VIDEOEXPOSE: if(Game->GetCurrentMode() != GM_PLAY) { mainmenu->Resize(); optionsmenu->Resize(); } break; case SDL_QUIT: _Running=false; break; case SDL_ACTIVEEVENT: if(event->active.state & SDL_APPACTIVE) { if(event->active.gain) _Active = true; else _Active = false; } break; default: break; } }
int main(int argc, char *argv[]) { SDL_Surface *screen; FILE *f; int i=0; MainMenu Menu; TTF_Init(); /* Инициализируем SDL_ttf*/ srand(time(NULL)); /*рандом для выбора уровня*/ if(SDL_Init(SDL_INIT_VIDEO) < 0) return 0; /*инициализируем SDL в режиме работы с видео*/ SDL_WM_SetCaption("Gruzchik", NULL); /*название окошка*/ screen = SDL_SetVideoMode( HEIGHT , WIDTH , 32 , SDL_DOUBLEBUF|SDL_HWSURFACE|SDL_ANYFORMAT); /*создание окна с разрешением HEIGHTхWIDTH, 32 бита*/ if (screen == NULL) { perror("Error!"); return 0; /*Если окно не создалось - выходим*/ } SDL_FillRect(screen , NULL , 0x000000);/* закрашиваем экран черным */ Menu.Zastavka1(screen); /*Заставка*/ SDL_Flip(screen); SDL_Delay(2000); SDL_FillRect(screen , NULL , 0x000000); Menu.Zastavka2(screen); /*Вводим имя*/ SDL_Flip(screen); SDL_FillRect(screen , NULL , 0x000000); while (Menu.DrawMenu(screen) == 0); atexit(SDL_Quit); return 0; }