int main( int argc, char *argv[] ) { fatInitDefault(); if( argc >= 2 ) { if( strcmp( argv[1], "--help" ) == 0 || strcmp( argv[1], "-h" ) == 0 ) { printf( "%s V.%s\n\n", CAPTION, VERSION ); printf( "Usage: %s [OPTIONS] [LEVELFILE]\n", argv[0] ); printf( "Where LEVELFILE is the name of the level to play or OPTIONS is one of the following.\n" ); printf( "-h, --help\tDisplay this message\n" ); printf( "-v, --version\tShow the version of this binary\n" ); return 0; } else if( strcmp( argv[1], "--version" ) == 0 || strcmp( argv[1], "-v" ) == 0 ) { printf( "%s %s\n", CAPTION, VERSION ); return 0; } else { printf( "Unknown argument %s\n", argv[1] ); } } Leveleditor_Mode = 0; Game_debug = 0; cameraposx = 0; cameraposy = 0; MassiveObjects.reserve( 1000 ); PassiveObjects.reserve( 1000 ); ActiveObjects.reserve( 500 ); EnemyObjects.reserve( 500 ); srand( time( NULL ) ); atexit( ExitGame ); if( argc == 2 ) { StartGame( argv[1] ); } else { StartGame(); } while( !done ) { ProcessEvents(); ProcessInput(); UpdateGame(); Framerate.Update(); } ExitGame(); return 0; // Successful }
void MainWindow::Play(const std::optional<std::string>& savestate_path) { // If we're in a paused game, start it up again. // Otherwise, play the selected game, if there is one. // Otherwise, play the default game. // Otherwise, play the last played game, if there is one. // Otherwise, prompt for a new game. if (Core::GetState() == Core::State::Paused) { Core::SetState(Core::State::Running); EnableScreenSaver(false); } else { std::shared_ptr<const UICommon::GameFile> selection = m_game_list->GetSelectedGame(); if (selection) { StartGame(selection->GetFilePath(), savestate_path); EnableScreenSaver(false); } else { QString default_path = QString::fromStdString(SConfig::GetInstance().m_strDefaultISO); if (!default_path.isEmpty() && QFile::exists(default_path)) { StartGame(default_path, savestate_path); EnableScreenSaver(false); } else { Open(); } } } }
void jointeam_handler (edict_t *ent, int option) { int num=0; joined_t *slot=NULL; // exit menu if (option == 3) return; // let them join if we are still in pre-game or were here before if (level.time < pregame_time->value || ((slot = GetJoinedSlot(ent)) != NULL)) { StartGame(ent); // set their team value and then clear the slot if (slot) { ent->teamnum = slot->team; ClearJoinedSlot(slot); } return; } // always allow administrators into the game if (ent->myskills.administrator) { StartGame(ent); OrganizeTeams(true); return; } }
void MainWindow::Play() { // If we're in a paused game, start it up again. // Otherwise, play the selected game, if there is one. // Otherwise, play the default game. // Otherwise, play the last played game, if there is one. // Otherwise, prompt for a new game. if (Core::GetState() == Core::State::Paused) { Core::SetState(Core::State::Running); emit EmulationStarted(); } else { QString selection = m_game_list->GetSelectedGame(); if (selection.length() > 0) { StartGame(selection); } else { QString default_path = Settings::Instance().GetDefaultGame(); if (!default_path.isEmpty() && QFile::exists(default_path)) { StartGame(default_path); } else { Open(); } } } }
//************************************************************************ void CNutDropScene::OnLButtonDown (HWND hWnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) //************************************************************************ { if (m_SoundPlaying == IntroPlaying) { m_SoundPlaying = NotPlaying; m_pSound->StopChannel (NORMAL_CHANNEL); StartGame(); } else if (m_SoundPlaying == SuccessPlaying) { m_SoundPlaying = NotPlaying; GetSound()->StopChannel(NORMAL_CHANNEL); // Start the looping soundtrack if one is defined FNAME szFileName; if (GetSound() && m_szSoundTrack[0] != '\0') GetSound()->StartFile (GetPathName (szFileName, m_szSoundTrack), YES/*bLoop*/, MUSIC_CHANNEL, FALSE); // If Play mode, go to the next scene if (m_nSceneNo == IDD_NUTDROPI) FORWARD_WM_COMMAND (m_hWnd, IDC_NEXT, NULL, m_nNextSceneNo, PostMessage); else StartGame(); } }
void record_R() { struct Record r[10]; int i; char ip = '\0'; FILE *f; f = fopen("record.txt", "r"); for (i = 0; i<10; i++) fscanf(f, "%s %d\n", r[i].name, &r[i].Level); fclose(f); printf("이름 점수\n"); printf("------------------\n"); for (i = 0; i<10; i++) printf("%s %d\n", r[i].name, r[i].Level); ip = _getch(); if (ip == ESC)exit(0); else { system("cls"); ConsoleInit(); DrawField(); CreateBoard(); StartGame(); } }
MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters) : QMainWindow(nullptr) { setWindowTitle(QString::fromStdString(Common::scm_rev_str)); setWindowIcon(Resources::GetAppIcon()); setUnifiedTitleAndToolBarOnMac(true); setAcceptDrops(true); InitControllers(); CreateComponents(); ConnectGameList(); ConnectHost(); ConnectToolBar(); ConnectRenderWidget(); ConnectStack(); ConnectMenuBar(); ConnectHotkeys(); InitCoreCallbacks(); NetPlayInit(); if (boot_parameters) StartGame(std::move(boot_parameters)); }
void CheckNewConnections() { Connection *c; while ((c = nl->getNewConnection()) != NULL) { MakeDirty(); if (next) { next->b = c; StartGame(next); next = NULL; } else { next = new Game(); next->a = c; MakeDirty(); } } if (next != 0) { Packet *p = nl->receivePacketFromConnection(next->a); if (p != 0) { // sending packets before connecting? destroy! nl->destroyPacket(p); goto dumb_client_is_dumb; } else if (!nl->connectionIsAlive(next->a)) { dumb_client_is_dumb: nl->destroyConnection(next->a); delete next; next = NULL; MakeDirty(); } } }
BeCheckersWindow::BeCheckersWindow(BRect frame, const char *title) : BWindow(frame, title, B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE) { BMenuBar *mb = new BMenuBar(BRect(0, 0, frame.right, 15), "MenuBar"); BMenu *menu = new BMenu("File"); menu->AddItem(new BMenuItem("New", new BMessage(BECHECKERS_NEW), 'N')); menu->AddItem(new BMenuItem("Open...", new BMessage(BECHECKERS_OPEN), 'O')); menu->AddSeparatorItem(); menu->AddItem(new BMenuItem("Save", new BMessage(BECHECKERS_SAVE), 'S')); menu->AddItem(new BMenuItem("Save As", new BMessage(BECHECKERS_SAVEAS))); menu->AddSeparatorItem(); menu->AddItem(new BMenuItem("About BeCheckers...", new BMessage(B_ABOUT_REQUESTED))); menu->AddSeparatorItem(); menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q')); mb->AddItem(menu); AddChild(mb); mvIndicationLabel = new BStringView(BRect(0, 472, 450, 485), "Status", "Dark to move"); mvIndicationLabel->SetViewColor(232, 232, 232); mvIndicationLabel->SetAlignment(B_ALIGN_CENTER); AddChild(mvIndicationLabel); StartGame(); }
DGameTracker::DGameTracker(QWidget* parent_widget) : QStackedWidget(parent_widget), m_watcher(this) { connect(&m_watcher, SIGNAL(directoryChanged(QString)), this, SLOT(ScanForGames())); m_tree_widget = new DGameTree(this); addWidget(m_tree_widget); connect(m_tree_widget, SIGNAL(StartGame()), this, SIGNAL(StartGame())); m_grid_widget = new DGameGrid(this); addWidget(m_grid_widget); connect(m_grid_widget, SIGNAL(StartGame()), this, SIGNAL(StartGame())); SetViewStyle(STYLE_LIST); }
void TetrixController::OnLeftButtonDownEvent(WPARAM wParam, LPARAM lParam) { if (GamePreparing == m_status || GameEnded == m_status) { int x = LOWORD(lParam); int y = HIWORD(lParam); RECT rect; ::GetClientRect(m_hWnd, &rect); int w = rect.right - rect.left; int h = rect.bottom - rect.top; if (abs(x - w / 2) <= w / 8) { int ph = w / 4 / 3; if (y >= h / 2 && y <= (h / 2 + ph)) { m_spSound->PlayClick(); StartGame(); } else if (y >= (h / 2 + ph * 2) && y <= (h / 2 + ph * 3)) { if (GamePreparing == m_status) { m_spSound->PlayClick(); ::PostQuitMessage(0); } else { m_spSound->PlayClick(); BackToMenu(); } } } } }
void CNetServerWorker::Run() { // The script runtime uses the profiler and therefore the thread must be registered before the runtime is created g_Profiler2.RegisterCurrentThread("Net server"); // To avoid the need for JS_SetContextThread, we create and use and destroy // the script interface entirely within this network thread m_ScriptInterface = new ScriptInterface("Engine", "Net server", ScriptInterface::CreateRuntime(g_ScriptRuntime)); m_GameAttributes.set(m_ScriptInterface->GetJSRuntime(), JS::UndefinedValue()); while (true) { if (!RunStep()) break; // Implement autostart mode if (m_State == SERVER_STATE_PREGAME && (int)m_PlayerAssignments.size() == m_AutostartPlayers) StartGame(); // Update profiler stats m_Stats->LatchHostState(m_Host); } // Clear roots before deleting their context m_GameAttributes.clear(); m_SavedCommands.clear(); SAFE_DELETE(m_ScriptInterface); }
int WolfMain(int argc, char *argv[]) { WaitTick(); /* Wait for a system tick to go by */ playstate = (exit_t)setjmp(ResetJmp); NumberIndex = 36; /* Force the score to redraw properly */ IntermissionHack = FALSE; if (playstate) { goto DoGame; /* Begin a new game or saved game */ } JumpOK = TRUE; /* Jump vector is VALID */ FlushKeys(); /* Allow a system event */ Intro(); /* Do the game intro */ for (;;) { if (TitleScreen()) { /* Show the game logo */ StartSong(SongListPtr[0]); ClearTheScreen(BLACK); /* Blank out the title page */ BlastScreen(); SetAPalette(rBlackPal); if (ChooseGameDiff()) { /* Choose your difficulty */ playstate = EX_NEWGAME; /* Start a new game */ DoGame: FadeToBlack(); /* Fade the screen */ StartGame(); /* Play the game */ } } /* TODO: demos or whatever here */ } return 0; }
INT_PTR CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId; switch (message) { case WM_INITDIALOG: hMainWND = hWnd; hLogin = GetDlgItem(hWnd, IDC_LOGIN); hPassword = GetDlgItem(hWnd, IDC_PASSWORD); return (INT_PTR)TRUE; case WM_COMMAND: wmId = LOWORD(wParam); if (wmId == IDB_START) { CheckAccount(); if (StartGame()) { // start game SetCurrentDirectory("./Bin32"); ShellExecute(NULL, "open", "Icarus.exe", startparam, NULL, SW_NORMAL); Sleep(100); EndDialog(hWnd, LOWORD(wParam)); } } break; case WM_CLOSE: EndDialog(hWnd, LOWORD(wParam)); return (INT_PTR)TRUE; } return (INT_PTR)FALSE; }
void GSNewOrContinue::OnActive() { GSText::OnActive(); CreateText(""); m_gui = WWLoadGui("gui-neworcontinue.txt"); Assert(m_gui); // TODO Set focus element, cancel element, command handlers GuiButton* cont = (GuiButton*)m_gui->GetElementByName("continue-button"); cont->SetCommand(OnContinue); cont->SetIsFocusButton(true); cont->SetShowIfFocus(true); m_gui->GetElementByName("more-button")->SetCommand(OnMore); m_gui->GetElementByName("hiscores-button")->SetCommand(OnHiScores); m_gui->GetElementByName("back-button")->SetCommand(OnBack); TheSoundManager::Instance()->PlaySong("sound/piano.it"); // If no continue info, go directly to new game. GameConfigFile* gcf = TheGameConfigFile::Instance(); if (!gcf->Exists(CONTINUE_LEVEL_KEY)) { // New game TheLevelManager::Instance()->SetLevelId(1); GameConfigFile* gcf = TheGameConfigFile::Instance(); gcf->SetInt(CONTINUE_LEVEL_KEY, 1); StartGame(1, AMJU_MAIN_GAME_MODE); return; } }
GameTheory::GameTheory(QWidget *parent, Qt::WFlags flags) : QWidget(parent, flags) { ui.setupUi(this); connect( ui.heap_button_1, SIGNAL(clicked()), this, SLOT(HeapButtonClicked()) ); connect( ui.heap_button_2, SIGNAL(clicked()), this, SLOT(HeapButtonClicked()) ); connect( ui.heap_button_3, SIGNAL(clicked()), this, SLOT(HeapButtonClicked()) ); connect( ui.ok_button_1, SIGNAL(clicked()), this, SLOT(OkButtonClicked()) ); connect( ui.ok_button_2, SIGNAL(clicked()), this, SLOT(OkButtonClicked()) ); connect( ui.ok_button_3, SIGNAL(clicked()), this, SLOT(OkButtonClicked()) ); TurnOffOkButtons(); TurnOffHeapButtons(); connect (ui.ok_candies, SIGNAL(clicked()), this, SLOT(CandiesChosen())); start_timer = new QTimer(this); timer_to_watch_AI = new QTimer(this); connect(timer_to_watch_AI, SIGNAL(timeout()), this, SLOT(SwitchTurnToPlayer())); connect(start_timer, SIGNAL(timeout()), this, SLOT(StartGame())); current_active_player = 1; is_start_of_the_game = true; ai_player = 2; number_of_candies = 100; available_candies = number_of_candies; number_of_unselected_heaps = 3; game_finished = false; candies_in_heap.resize(3, 0); ui.informer->setText(QString("Choose a player and the number of candies")); }
int main(void) { auto renderWindow = CreateRenderWindow(); auto inputComponent = CreateInputHandler(renderWindow); auto gameBoard = CreateGameBoard(); const auto numTiles = gameBoard->GetNumTiles(); auto renderComponent = CreateGameRenderer(*gameBoard, renderWindow); auto boardController = std::make_unique<BoardController>(std::move(gameBoard)); auto playerController = CreatePlayerController(NUM_PLAYERS); { auto chooser = std::make_shared<TileChooser>(NUM_PLAYERS, 10, *renderComponent); inputComponent->AddObserver(chooser); chooser->ChooseTiles(); //chooser->AutoChooseTiles(); chooser->AssignTilesToPlayers(*playerController); } { auto manager = std::make_shared<GameManager>(std::move(renderComponent), std::move(boardController), playerController); inputComponent->AddObserver(manager); playerController->ObserveTimers(manager); manager->StartGame(); } glfwDestroyWindow(renderWindow); glfwTerminate(); }
INT cGame::Run() { // seed rand srand((unsigned)timeGetTime()); StartGame(); return GameLoop(); }
void CMenuState::OnClick(int button, int action, double x, double y) { GLubyte res[4]; GLint viewport[4]; // render selection RenderSelection(); glGetIntegerv(GL_VIEWPORT, viewport); glReadPixels(x, viewport[3] - y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &res); if (action == GLFW_PRESS) { SoundsHandler::SoundOptions options; options._isRelativeToListener = true; switch (res[0]) { case 0: printf("None clicked\n"); typing = false; break; case 1: printf("Textbox clicked\n"); if (username == default_name) { ClientGame::instance()->PlaySound("Button_Click", options); username.clear(); } typing = true; break; case 2: printf("Button clicked\n"); ClientGame::instance()->PlaySound("Button_Click", options); StartGame(); break; default: printf("%d clicked%s\n", res[0]); ClientGame::instance()->PlaySound("Button_Click", options); typing = false; } } }
static void CheckStartGame(void) { if (AllNodesReady()) { StartGame(); } }
void SelfPlay() { printf("\n\n--------------The Bot Will Now Play itself to Some Randomized Depth-------------\n\n"); printf("Press Any Key To See The Next Move\n"); BOARD *board=new BOARD; SetStart(board); getchar(); while(1) { MOVE *list=new MOVE; GenMoves(board,list); if(list->Count==0) { printf("%c LOST THE GAME\n\n",PceSideChar[board->Side]); break; } int Depth=5+rand()%4; vector<int>BestMove=SearchPos(board,Depth); PrintBoard(board); MakeMove(board,BestMove); getchar(); getchar(); } StartGame(); }
// Used for getting involved player guid. Parameter id is used for defining if is a large(Monument) or small(Relic) node void SetGUID(ObjectGuid guid, int32 id) override { me->SetCanFly(true); large = id != 0; playerGUID = guid; StartGame(); }
void Lobby::Start(std::shared_ptr<Connection> connection) { connections_.insert(connection); waiting_.insert(connection); connection->Run(); if (waiting_.size() >= players_per_game_) StartGame(); }
// Used for getting involved player guid. Parameter id is used for defining if is a large(Monument) or small(Relic) node void SetGUID(uint64 guid, int32 id) { me->SetCanFly(true); large = (bool)id; playerGUID = guid; StartGame(); }
int main() { ConsoleInit(); DrawField(); CreateBoard(); StartGame(); SetCursors(0, 0); }
void GameLevelChooser::ConfirmButtonPressed() { int _level=5, _gameNo = 1; QStringList levelText = levelChooser->Value().split("×"); _level = levelText.at(0).toInt(); _gameNo = gameNoChooser->Value().toInt(); emit StartGame(_level,_gameNo); }
void BBWin8Game::Run(){ if( CFG_WIN8_SCREEN_ORIENTATION & 1 ){ _deviceRotation=0; }else if( CFG_WIN8_SCREEN_ORIENTATION & 2 ){ _deviceRotation=1; }else if( CFG_WIN8_SCREEN_ORIENTATION & 4 ){ _deviceRotation=2; }else if( CFG_WIN8_SCREEN_ORIENTATION & 8 ){ _deviceRotation=3; }else{ _deviceRotation=0; } ValidateOrientation(); StartGame(); for(;;){ if( _updateRate==60 ){ PollEvents(); UpdateGame(); RenderGame(); continue; } if( !_updateRate || _suspended ){ RenderGame(); WaitEvents(); continue; } double time=GetTime(); if( time<_nextUpdate ){ Sleep( _nextUpdate-time ); continue; } PollEvents(); int updates=0; for(;;){ _nextUpdate+=_updatePeriod; UpdateGame(); if( !_updateRate ) break; if( _nextUpdate>GetTime() ){ break; } if( ++updates==8 ) break; } RenderGame(); if( updates==8 ) _nextUpdate=GetTime(); } }
static void OnContinue(GuiElement*) { GameConfigFile* gcf = TheGameConfigFile::Instance(); Assert(gcf->Exists(CONTINUE_LEVEL_KEY)); int level = gcf->GetInt(CONTINUE_LEVEL_KEY, 1); Assert(level > 0); TheLevelManager::Instance()->SetLevelId(level); StartGame(1, AMJU_MAIN_GAME_MODE); }
int main(int argc, char * argv[]) { cGameLoop StartGame(argv, argc); //object that is passed command line args StartGame.BeginGame(); //object calls method to start game return 0; }
void IntroDoctor::Update() { viewTime++; if( viewTime > FRAMES_PER_SECOND * 7 ) { StartGame(); return; } }