int main ( int argc, char *argv[] ) { CGameEngine game; game.Init( "Engine Test v1.0" ); game.ChangeState( CIntroState::Instance() ); game.Run(); game.Cleanup(); return 0; }
int main(int argc, char** argv) { CGameEngine game; int width = 1600; int height = 900; if(bool tiny = false) { width /= 3; height /= 3; } game.Init("Leap", width, height, 16, false); game.ChangeState( CPlayState::Instance() ); while (game.Running()) { game.HandleEvents(); game.Update(); game.Draw(); } game.Cleanup(); return 0; }
CombatMode::CombatMode(CPlayer *pCPlayer, CCombatant *pCCombatant, CMonster *pMonster) { m_pPlayer = pCPlayer; m_pCombatant = pCCombatant; m_pMonster = pMonster; CGameEngine *engine = CGameEngine::Instance(); // Set camera position for combat mode. engine->SetCameraPosition( Vector3( 8750, 0, 8750 )); // Set Combat GUI Mode. engine->SetGUIMode( BATTLEMODEMENU ); // Set Enemy position. pMonster->getNode()->setPosition(engine->GetCameraPosition() + engine->GetCameraDirection() * 150 ); // Set Players turn on. m_bPlayersTurn = true; // Set starting Combat text. AddStringToCombatLog( "Starting battle with " + pCCombatant->GetName() ); }
int main(int argc, char* argv[]) { std::cout<<"Starting Snake v1.1 [EZX]...\n Author: Schan\n Porting: BruceLee\n\n"; // some inits... srand(time(0)); if (TTF_Init() > 0) { fprintf(stderr, "Unable to TTF SDL: %s\n", TTF_GetError()); exit(1); } // create game CGameEngine *game = new CGameEngine(30,false,10); game->SetTitle("Loading..."); game->Init(); SDL_ShowCursor(false); int lang = 0; // load options FILE *fp = fopen("snake.cfg","r"); if (fp!=NULL) { char str[32]; int v; fscanf(fp,"%s %d",&str,&v); if (strcmp(str,"lang")==0) { lang = v; } fclose(fp); } // create info object. // need game->Init(). actually, need a video mode set (made in game->Init()); CSnakeGameInfo *info = new CSnakeGameInfo(lang); // create and add states. need info created CGameState *startingLevelState = new CStartingLevelState(info); CGameState *playingState = new CPlayingState(info); CGameState *pauseState = new CPauseState(info); CGameState *exitState = new CExitRequestedState(info); CGameState *lostLifeState = new CLostLifeState(info); CGameState *lostLastLifeState = new CLostLastLifeState(info); CGameState *menuState = new CMenuState(info); CGameState *optionsState = new COptionsState(info); CGameState *helpState = new CHelpState(info); game->AddState(startingLevelState,ST_STARTING_LEVEL); game->AddState(playingState,ST_PLAYING); game->AddState(pauseState,ST_PAUSE); game->AddState(lostLifeState,ST_LOST_LIFE); game->AddState(lostLastLifeState,ST_LOST_LAST_LIFE); game->AddState(exitState,ST_EXIT_REQUESTED); game->AddState(menuState,ST_MENU); game->AddState(optionsState,ST_OPTIONS); game->AddState(helpState,ST_HELP); // Show Splash ShowSplash(); // start game game->SetTitle("Snake!"); game->Start(ST_MENU); game->SetTitle("Quiting..."); // clean delete startingLevelState; delete playingState; delete pauseState; delete exitState; delete lostLifeState; delete lostLastLifeState; delete menuState; delete optionsState; delete helpState; /* chdir("/usr/gp2x"); execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);*/ return 0; }