コード例 #1
0
ファイル: main.cpp プロジェクト: akrutsinger/Cards
void Initialize() // must be called only once
{
	//do some initialization and create the regions in here

	SDL_WM_SetCaption("Scorpion", NULL); // Set the window title
	font1 = initFont("font/data/font1");
	font2 = initFont("font/data/font2");

	InitDeck(screen);
	Scorpion.Initialize(screen);

	//index 0: The Stock
 	Scorpion.CreateRegion(CRD_STOCK,
						CRD_VISIBLE|CRD_3D,
						0,
						0,
						CRD_OSYMBOL,
						(SCREEN_WIDTH / 2) - (CARDWIDTH / 2), 400,
						2, 2);

	//index 1-7: The tableau
	for(int i=1; i <= 7; i++){
		Scorpion.CreateRegion(CRD_TABLEAU,
							CRD_VISIBLE|CRD_FACEUP|CRD_DODRAG|CRD_DODROP,
							CRD_DOLOWER|CRD_DOKING,
							CRD_DRAGCARDS,
							CRD_HSYMBOL,
							(CARDWIDTH * (i - 1)) + (i * 35), 10,
							0, 25);
	}
}
コード例 #2
0
ファイル: main.cpp プロジェクト: DavidKoenig/Soccer
int main( int argc, const char* argv[] )
{
	CGame game;
	game.runGame();

	return 0;
}
コード例 #3
0
ファイル: Application.cpp プロジェクト: Taka03/Camerun2
//=============================================================================
//起動
//=============================================================================
void CApplication::Run()
{
	//コアの生成
	CreateCore();
	
	//初期化処理
	CCommonObject::Initialize();
	
	CGame Game;
	
	/*初期化*/
	if( m_pCore->Initialize( m_strAppName.c_str() , FRAME_RATE_60 ) )
	{
		Initialize();
		
		while( GetCore()->Run() )
		{
			Game.Run();
		}
		
	}
	
	//終了処理
	CCommonObject::Finalize();
	

}
コード例 #4
0
int main(void)
{    
    CGame game;
    game.gameLoop();              

    return 0;
}//main
コード例 #5
0
ファイル: main.cpp プロジェクト: VladimirUPBC/Naves_Inicio
// La función principal del juego
int main(int argc, char *argv[]){
	CGame *navesGame = new CGame();//Crea un objeto usando apuntadores

	if(navesGame->Start())   
		navesGame->Finalize(); // Liberamos los recursos utilizados.
    
    return EXIT_SUCCESS;
}
コード例 #6
0
ファイル: 2048.cpp プロジェクト: artkingsun/Super2048
int _tmain(int argc, _TCHAR* argv[])
{
	srand((int)time(0));
	CGame *game = new CGame;
	game->GameRun();
	delete game;
	return 0;
}
コード例 #7
0
ファイル: main.cpp プロジェクト: easy63/RPG
int main()
{
	CGame* pGame = new CGame();
	pGame->run();
	delete pGame;

    return 0;
}
コード例 #8
0
ファイル: Main.cpp プロジェクト: charlesHetterich/Block-Ninja
int main(int argc, char *argv[])
{
	CGame* game = new CGame();

	game->gameLoop();

	return 0;
}
コード例 #9
0
ファイル: matejjon.cpp プロジェクト: jonatan1024/Battleship
int main() {
	initCurses();
	CGame game;
	game.Init();
	while(game.GameLoop()) {}
	stopCurses();
	return 0;
}
コード例 #10
0
ファイル: main.cpp プロジェクト: winktzhong/Commander-Genius
/**
 * \brief  This is the function where CG beings
 *
 * \param	argc   	number of arguments
 * \param	argv   	pointer to  char arrays where
 * 					where the passed arguments are stored
 * 					in the process
 * \return	        This always returns 0. If
 * 					some errors appear, take a look
 * 					at the Logfile.
 *
 */
int main(int argc, char *argv[])
{

#if SDL_VERSION_ATLEAST(2, 0, 0)
    #ifdef ANDROID
        SDL_SetMainReady( );
    #endif
#endif

	// Check if CG should look into a given directory
	if(argc >= 1)
	{
		binary_dir = argv[0];
		size_t slashpos = findLastPathSep(binary_dir);
		
		if(slashpos != std::string::npos)
		{
			binary_dir.erase(slashpos);
			binary_dir = SystemNativeToUtf8(binary_dir);
		}
		else
		{
			binary_dir = ".";
		}
	}
	else
	{
		warnings << "Binary-argument not given, assuming current dir" << endl;
		binary_dir = ".";
	}

	binary_dir = GetAbsolutePath(binary_dir);

	InitThreadPool();
	InitSearchPaths();

	g_pLogFile->CreateLogfile("CGLog.html");

	// The Game Class instance is the main class managing whole
	// interpreter instance. TODO: It should be a singleton
	CGame Game;
	
	////////////////////////////
	// Initialize Game Engine //
	////////////////////////////
	if( Game.init( argc, argv ) )
	{
		///////////////////////
		// Start Game Engine //
		///////////////////////
		Game.run();
	}

	std::cout << "Thank you very much for playing this game!" << std::endl;

	UnInitThreadPool();
	return 0;
}
コード例 #11
0
ファイル: CGUI.cpp プロジェクト: Gamesnert/multitheftauto
void CLocalGUI::Draw ( void )
{
    // Get the game interface
    CGame* pGame = CCore::GetSingleton ().GetGame ();
    eSystemState SystemState = pGame->GetSystemState ();
    CGUI* pGUI = CCore::GetSingleton ().GetGUI ();

    // Update mainmenu stuff
    m_pMainMenu->Update ();

	// Make sure our version labels are always visible
	static short WaitForMenu = 0;
	if ( SystemState == 7 || SystemState == 9 ) {
		if ( WaitForMenu < 250 ) {
			WaitForMenu++;
		} else {
			m_pLabelVersionTag->SetVisible ( true );
		}
	}

    // If we're ingame, make sure the chatbox is drawn
    bool bChatVisible = ( SystemState == 9 /* GS_INGAME */ && m_pMainMenu->GetIsIngame () && m_bChatboxVisible && !CCore::GetSingleton ().IsOfflineMod() );
    if ( m_pChat->IsVisible () != bChatVisible )
        m_pChat->SetVisible ( bChatVisible );
    bool bDebugVisible = ( SystemState == 9 /* GS_INGAME */ && m_pMainMenu->GetIsIngame () && m_pDebugViewVisible && !CCore::GetSingleton ().IsOfflineMod() );
    if ( m_pDebugView->IsVisible () != bDebugVisible )
        m_pDebugView->SetVisible ( bDebugVisible );

    // Make sure the cursor is displayed only when needed
    UpdateCursor ();

	// Draw the chat
    m_pChat->Draw ();
    // Draw the debugger
    m_pDebugView->Draw ();

    // If we're not at the loadingscreen
    static bool bDelayedFrame = false;
    if ( SystemState != 8 || !bDelayedFrame /* GS_INIT_PLAYING_GAME */ )
    {
        // If we have a GUI manager, draw the GUI
        if ( pGUI )
        {
            pGUI->Draw ( );
        }
        else
        {
            WriteDebugEvent ( "WARNING: CLocalGUI::Draw() called, but CLocalGUI::CreateObjects() isn't!" );
        }

        // If the system state was 8, make sure we don't do another delayed frame
        if ( SystemState == 8 )
        {
            bDelayedFrame = true;
        }
    }
}
コード例 #12
0
ファイル: packet_handler.cpp プロジェクト: Crumbtray/WarGames
	//Turn Change
	void Packet0x13(session_data_t* session, CPlayer* player, int8* data)
	{
		CGame* game = games::getGame(player);

		if (game && game->isActivePlayer(player))
		{
			game->endTurn();
		}
	}
コード例 #13
0
ファイル: main.cpp プロジェクト: solacedagony/CloneRPG
int main( int argc, const char* argv[] )
{
	CGame *game = new CGame;
	game->start();

	delete game;

	return 0;
}
コード例 #14
0
ファイル: SystemTestDlg.cpp プロジェクト: donilan/study
UINT CheckStatusThread(LPVOID lpVoid)
{
	CGame* game = (CGame*)lpVoid;
	while(TRUE)
	{
		TRACE("Game status: %d\n", game->getStatus());
		Sleep(500);
	}
	
}
コード例 #15
0
ファイル: main.cpp プロジェクト: rpmessner/Marbles
int WINAPI WinMain(	HINSTANCE	hInstance,			// Instance
					HINSTANCE	hPrevInstance,		// Previous Instance
					LPSTR		lpCmdLine,			// Command Line Parameters
					int			nCmdShow)			// Window Show State
{
	MSG msg;
	CGame game;
	msg.wParam = game.Start();
	return (msg.wParam);							// Exit The Program
}
コード例 #16
0
ファイル: gamecontroller.cpp プロジェクト: mahaserver/MHSVLC
// -----------------------------------------------------------------------------
// CGameController::StartGameL
// Intializes the Game and Starts the game loop.
// -----------------------------------------------------------------------------
//
void CGameController::StartGameL( CGame& aGame )
{    
    iGame = &aGame;   
    
    // Allow the game to initialize itself.
    // The opengl es state intialization is done here.
    aGame.Initialize( iWindow->Size().iWidth, iWindow->Size().iHeight );
    
    TTime currentTime;
    TTime lastTimeVisited;
    lastTimeVisited.HomeTime();    
        
    while( 1 ) // Loop until the Game wants to exit.
    {       
        // Process any pending tasks.
        // This runs any Active objects that are waiting for 
        // some processing. 
        // The CWsEventReceiver Active Object gets a chance to
        // run here (on a key event for example).
        ProcessBackgroundTasks( EFalse );
                
        // If the application is not in focus or is not visible.
        // Block until it regains focus.
        while( EFalse == iIsAppInFocus || EFalse == iIsVisible )
            ProcessBackgroundTasks( ETrue );
                
        // Get the current time.
        currentTime.HomeTime();       
        TTimeIntervalMicroSeconds dur 
                    = currentTime.MicroSecondsFrom( lastTimeVisited );                        
                
        // The game renders itself using opengl es apis.
        // A return value of EFalse signifies an exit from the game.
        // Pass in the time (in micro secs) elapsed since last call. 
        if( EFalse == aGame.RenderFrame( dur.Int64() ) )
        {
            break;
        }                                

        // Call eglSwapBuffers, which blits the graphics to the window.
        eglSwapBuffers( iEglDisplay, iEglSurface );    

        // To keep the background light on.
        if( !( ( iGame->GetCurrentFrame() )%100 ) )
        {
            User::ResetInactivityTime();
        }
        
        // Store the last time the Game was rendered.
        lastTimeVisited = currentTime;
    }
    
    // Cleanup.
    aGame.Cleanup();    
}
コード例 #17
0
ファイル: exacto.cpp プロジェクト: d-sparks/exacto
int main() {

    cout << "\n   exacto[0.f]  \n <<------------------------------->>  \n             by Daniel Sparks, USA  \n" << endl << endl;
    cout << "Type 'game' for gameplay commands, or 'help' for all commands." << endl << endl;

    int i, j;
    string user_input;

    /* These are the coefficients for the piece square tables (see fill_PST), which can later be optimized 3 at a time. */

    // unoptimized: int16_t C[4][3] = { { 0, 0, 0 }, { 1, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 } };

    int16_t C[7][3] = { { 0, 0, 0 }, { 1, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 0, 0 } };

    CEngine exacto;
    CEngine exacto2;
    CGame game;
    initialize();
    fill_PST(C);
    parse_book("book.bin");
    exacto.book_mode = is_book(true) ? _BOOK_MODE : BOOK_DISABLED;
    game.set_board("Default", "", "", "", "", "");


/*// Consolidate:

    string file[5] = { "tuneraz_11.txt", "tuneraz_12.txt", "tuneraz_13.txt", "tuneraz_14.txt", "tuneraz_15.txt" };
    int score[30] = { 0 };
    uint32_t m = 0, n = 0, r = 0;

    for(int p = 0; p < 5; p++)
        parse_tuning_file(&m, &n, &r, score, file[p]);
    int mu = 0;
    for(int p = 1; p < 27; p++) { cout << p << " : " << (((double)score[p])/2) << endl; mu += score[p]; }

    cout << "Total games: " << mu << endl << "Mean: " << mu / 26 << endl;*/


    for(cin >> user_input; true; cin >> user_input) {
        next_command:

        if(user_input == "quit")
            break;


        else if((user_input == "xboard") || (user_input == "winboard"))
            exacto.post_pretty = false;


        else if(user_input == "protover") {
            cin >> user_input;
            cout << "feature ping=1 setboard=1 playother=1 san=0 usermove=1 time=1 draw=0 sigint=0 sigterm=0 reuse=1 analyze=0 colors=0 ics=0 name=0 pause=0 done=1" << endl;


        } else if(user_input == "accepted") {
コード例 #18
0
ファイル: Main.cpp プロジェクト: charlesHetterich/Multiverse
int main(int argc, char *argv[])
{
	CGame* game = new CGame();

	game->gameLoop();

	//delete game;
	game->saveGame();
	
	return 0;
}
コード例 #19
0
ファイル: main.cpp プロジェクト: CristianAM7/Naves_Inicio
// La función principal del juego
int main(int argc, char *argv[]){
	CGame *navesGame = new CGame();//Crea un objeto usando apuntadores

	if(navesGame->Start())   
		navesGame->Finalize(); // Liberamos los recursos utilizados.
	
	//PlaySound("musicafondo.wav",NULL, SND_FILENAME|SND_ASYNC);
	////"C:\\Users\\Cristian\\Documents\\GitHub\\Naves_Inicio\\Data\\*/
	//system("PAUSE");
    return EXIT_SUCCESS;
}
コード例 #20
0
ファイル: magicforest.cpp プロジェクト: marant/magicforest
int main(int argc, const char *argv[])
{
  CGame game;

  #ifdef DEBUG
    std::cout << "DEBUGGING IS ENABLED!" << std::endl;
  #endif
  game.Start();

  return 0;
}
コード例 #21
0
ファイル: main.cpp プロジェクト: PotHix/RobotzWarehouse
int main()
{
	CGame Game;
	
	// No fear, go ahead, son!
	Game.run();
	
	// Ok... Thanks for playing. ^^
	return 0;

}END_OF_MAIN()
コード例 #22
0
ファイル: main.cpp プロジェクト: Skeletalmesh/MarmaladeStumpd
// "main" is the S3E entry point
int main()
{
    Iw2DInit();

    // create game object
    CGame* pGame = new CGame;

    int currentUpdate = GetUpdateFrame();
    int nextUpdate = currentUpdate;

    // to exit correctly, applications should poll for quit requests
    while(!s3eDeviceCheckQuitRequest())
    {
        // run logic at a fixed frame rate (defined by UPS)

        // block until the next frame (don't render unless at
        // least one update has occurred)
        while(!s3eDeviceCheckQuitRequest())
        {
            nextUpdate = GetUpdateFrame();
            if( nextUpdate != currentUpdate )
                break;
            s3eDeviceYield(1);
        }

        // execute update steps
        int frames = nextUpdate - currentUpdate;
        frames = MIN(MAX_UPDATES, frames);
        while(frames--)
        {
            pGame->Update();
        }
        currentUpdate = nextUpdate;

        // render the results
        pGame->Render();

        // if an application uses polling input the application
        // must call update once per frame
        s3ePointerUpdate();
        s3eKeyboardUpdate();

        // S3E applications should yield frequently
        s3eDeviceYield();
    }

    // clear up game object
    delete pGame;

    Iw2DTerminate();

    return 0;
}
コード例 #23
0
ファイル: CGame.cpp プロジェクト: NojiriMisoten/OMTT
//*****************************************************************************
// クリエイト
//*****************************************************************************
CGame* CGame::Create(MODE_PHASE mode, LPDIRECT3DDEVICE9* pDevice)
{
	CGame* pGame = NULL;

	// 作成
	pGame = new CGame;

	// 初期化
	pGame->Init(mode, pDevice);

	return pGame;
}
コード例 #24
0
ファイル: lounge.cpp プロジェクト: jareens/pokerspot-dev
//
// Remove table from the waiting list that has
// - same game type
// - same limits
//
void CLounge::removeTableFromWaitingList(CTable* table)
{
    CGame* game = CGame::GetGame(table->getGameType());

    if (game)
    {
        WaitingLists& wls = game->getWaitingLists();

        WaitingLists::iterator pos = find_if(wls.begin(),
                                             wls.end(),
                                             same_limits(table->getLo(),
                                                         table->getHi()));
        if (pos != wls.end())
        {
            CWaitingList* wlist = (*pos);

            TableList& tlist = wlist->getTableList();
            TableList::iterator tpos = find_if(tlist.begin(),
                                               tlist.end(),
                                               same_socket(table->getSocket()));
            if (tpos != tlist.end())
            {   
                tlist.erase(tpos);

                // Send queue table removed
                CpduQueueUpdate pdu;
                pdu.sendQueueRemove(wlist->getQueueNumber(), table);

                CpduWaitinglistEvent pduEvent;
                pduEvent.sendRemove(wlist->getQueueNumber(), table);
            }
            else
            {
                printf("CLounge: Table not in waiting list: type %d lo: %d hi: %d",
                        table->getGameType(), table->getLo(), table->getHi());
            }
        }
        else
        {
            char s[128];
            sprintf(s, "CLounge: No waiting list with limits found: type %d lo: %d hi: %d",
                    table->getGameType(), table->getLo(), table->getHi());
            Sys_LogError(s);
        }
    }
    else
    {
        char s[128];
        sprintf(s, "CLounge: No game found for type %d", table->getGameType());
        Sys_LogError(s);
    }
}
コード例 #25
0
ファイル: main.cpp プロジェクト: mkaflowski/Tron-console-game
int main()
{
  try
  {
    CGame game;      
    game.play();
  }
  catch(string x)
  {
    cout<<x;
  }
  system("pause");
}
コード例 #26
0
// La función principal del juego
int main(int argc, char *argv[]){
	CGame *navesGame = new CGame();//Cra un objeto usando apuntadores
	/*for(int i=0;i<15;i++)
	{
		int azar = rand();
		printf("%d\n",azar%16);
	}
	getchar();*/

	if(navesGame->Start())   
		navesGame->Finalize(); // Liberamos los recursos utilizados.
    
    return EXIT_SUCCESS;
}
コード例 #27
0
ファイル: CivTWofMnM.cpp プロジェクト: Duney/Sine_Nomine
int main()
{
	#ifdef EDIT
		CEditor* pEditor = CEditor::GetInstance();

		while(pEditor->RunGameLoop());
	#else
		CGame* pGame = CGame::GetInstance();

		while(pGame->RunGameLoop());
	#endif

	return 0;
}
コード例 #28
0
int main (int argc, char* argv[])
{
	CGame Game;
	Uint32 frameStart;
    Uint32 frameTime;

	Game.Init();

	// load the intro
	Game.ChangeState( CMainMenuState::Instance() );

	// main loop
	while ( Game.Running() )
	{
	    frameStart = SDL_GetTicks();

		Game.HandleEvents();
		Game.Update();
		Game.Render();

		frameTime = SDL_GetTicks() - frameStart;

        if (frameTime < DELAY_TIME)
        {
            SDL_Delay((int) (DELAY_TIME - frameTime));
        }
	}

	// cleanup the engine
	Game.Cleanup();

	return 0;
}
コード例 #29
0
ファイル: lounge.cpp プロジェクト: jareens/pokerspot-dev
//
// Add table to the waiting list that has
// - same game type
// - same limits
//
void CLounge::addTableToWaitingList(CTable* table,
                                    u_int16_t gameType)
{
    CGame* game = CGame::GetGame(gameType);

    if (game)
    {
        WaitingLists& wls = game->getWaitingLists();

        WaitingLists::iterator pos = find_if(wls.begin(),
                                             wls.end(),
                                             same_limits(table->getLo(),
                                                         table->getHi()));
        if (pos != wls.end())
        {
            // Add the table to the waiting list
            CWaitingList* wlist = (*pos);
            wlist->addTable(gameType, table);

            // Send queue table added
            CpduQueueUpdate pdu;
            pdu.sendQueueAdd(wlist->getQueueNumber(), table);

            CpduWaitinglistEvent pduEvent;
            pduEvent.sendAdd(wlist->getQueueNumber(), table);

            // Send login stats update
            CpduLoungeStats pduStats;
            pduStats.sendStats(players_.size(), tables_.size());

            // Waiting list has new table, try seating players
            wlist->seatPlayers(table);
        }
        else
        {
            char s[128];
            sprintf(s, "CLounge: No waiting list with limits found: type %d hi: %d lo: %d",
                    gameType, table->getLo(), table->getHi());
            Sys_LogError(s);
        }
    }
    else
    {
        char s[128];
        sprintf(s, "CLounge: No game found for type %d", gameType);
        Sys_LogError(s);
    }
}
コード例 #30
0
ファイル: main.cpp プロジェクト: akrutsinger/Cards
int main(int argc, char *argv[])
{
	if( SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0 ){
		printf("Unable to initialize SDL: %s\n", SDL_GetError());
		exit(1);
	}
	atexit(SDL_Quit);

	screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32, SDL_HWSURFACE|SDL_HWPALETTE|SDL_DOUBLEBUF);
//	screen = SDL_SetVideoMode(800, 600, 32, SDL_SWSURFACE|SDL_HWPALETTE); //Slow


	if(screen == NULL)
	{
		printf("Unable to set 0x0 video: %s\n", SDL_GetError());
		exit(1);
	}

	Initialize();
	NewGame();
	Scorpion.DrawStaticScene();

	SDL_Event event;
	int done = 0;

	while(done == 0)
	{
		while(SDL_PollEvent(&event))
		{
			switch(event.type)
			{
				case SDL_QUIT:
     				return 0;

				case SDL_KEYDOWN:
     				if(event.key.keysym.sym == SDLK_ESCAPE) { done = 1; }
					HandleKeyDownEvent(event);
         			break;

				case SDL_MOUSEBUTTONDOWN:
					HandleMouseDownEvent(event);
  					break;

				case SDL_MOUSEMOTION:
					HandleMouseMoveEvent(event);
					break;

				case SDL_MOUSEBUTTONUP:
					HandleMouseUpEvent(event);
 					break;
			}
		}
	}

// perform cleaning up in here

	freeFont(font1);
	freeFont(font2);
	return 0;
}