当前位置: 首页>>代码示例>>C++>>正文


C++ LTimer::getTicks方法代码示例

本文整理汇总了C++中LTimer::getTicks方法的典型用法代码示例。如果您正苦于以下问题:C++ LTimer::getTicks方法的具体用法?C++ LTimer::getTicks怎么用?C++ LTimer::getTicks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LTimer的用法示例。


在下文中一共展示了LTimer::getTicks方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: loop

void loop () {
	//Handle events on queue
	while( SDL_PollEvent( &e ) != 0 )
	{
		//User requests quit
		if( e.type == SDL_QUIT )
		{
			quit = true;
		}
		
		//Handle input for the dot
		dot.handleEvent( e );
	}
	
	//Calculate time step
	float timeStep = stepTimer.getTicks() / 1000.f;

	//Move for time step
	dot.move( timeStep );

	//Restart step timer
	stepTimer.start();

	//Clear screen
	SDL_SetRenderDrawColor( gRenderer, 0xFF, 0xFF, 0xFF, 0xFF );
	SDL_RenderClear( gRenderer );

	//Render dot
	dot.render();

	//Update screen
	SDL_RenderPresent( gRenderer );
}
开发者ID:peterhenryfirst,项目名称:thecyclops,代码行数:33,代码来源:44_frame_independent_movement.cpp

示例2: update

void update()
{
    //Calculate time step
    float timeStep = stepTimer.getTicks()/1000.f;

    //pseudo:
    //update any world stuff (background objects, etc)

    //NPC AI
    //for each npc
    //npc.strategize

    //for each object in the world
    //object.framenumber++
    //object.move (x += xv, y += yv)

    //handle collisions
    //Move for time step
    stepTimer.start();

    //Calculate FPS
    timeText.str("");
    SDL_AtomicLock( &gDataLock );
    timeText << "FPS: " << framesThisSecond;
    SDL_AtomicUnlock( &gDataLock );

    if(!gFPSTextTexture.loadFromRenderedText(timeText.str().c_str(), fpsColor))
    {
        printf("Unable to render FPS texture.\n");
    }
}
开发者ID:jphinspace,项目名称:Safeguard2,代码行数:31,代码来源:SafeguardMain.cpp

示例3: loop

void loop () {
	//Handle events on queue
	while( SDL_PollEvent( &e ) != 0 )
	{
		//User requests quit
		if( e.type == SDL_QUIT )
		{
			quit = true;
		}
	}
	
	//Calculate and correct fps
	float avgFPS = countedFrames / ( fpsTimer.getTicks() / 1000.f );
	if( avgFPS > 2000000 )
	{
		avgFPS = 0;
	}
	
	//Set text to be rendered
	timeText.str( "" );
	timeText << "Average Frames Per Second " << avgFPS; 

	//Render text
	if( !gFPSTextTexture.loadFromRenderedText( timeText.str().c_str(), textColor ) )
	{
		printf( "Unable to render FPS texture!\n" );
	}

	//Clear screen
	SDL_SetRenderDrawColor( gRenderer, 0xFF, 0xFF, 0xFF, 0xFF );
	SDL_RenderClear( gRenderer );

	//Render textures
	gFPSTextTexture.render( ( SCREEN_WIDTH - gFPSTextTexture.getWidth() ) / 2, ( SCREEN_HEIGHT - gFPSTextTexture.getHeight() ) / 2 );

	//Update screen
	SDL_RenderPresent( gRenderer );
	++countedFrames;
}
开发者ID:peterhenryfirst,项目名称:thecyclops,代码行数:39,代码来源:24_calculating_frame_rate.cpp

示例4: run


//.........这里部分代码省略.........
    Animation * animation;
    
    //game->animations.push( new Slide(60, game->jewels.front(), make_pair(0,0), make_pair(0, 480)) );
    
    //While application is running
    while( !quit )
    {
        countedFrames++;
        keyDown = false;
        
        //Handle events on queue
        while( SDL_PollEvent( &e ) != 0 )
        {
            switch( e.type )
            {
                case SDL_QUIT:
                    quit = true;
                    break;
                case SDL_KEYDOWN:
                    keyDown = true;
                    break;
                case SDL_KEYUP:
                    keyDown = false;
                    break;
                default:
                    break;
            }
        }
        if ( keyDown )
            printf("Key down!\n");
        
        
        //Calculate and correct fps
        avgFPS = countedFrames / ( fpsTimer.getTicks() / 1000.f );
        
        //Set text to be rendered
        //timeText.str(std::string());
        //timeText << "Average Frames Per Second (With Cap): " << avgFPS << endl;
        //cout << timeText.str().c_str() << endl;
        
        scoreText.str(std::string());
        scoreText << "Score: " << game->getScore();
        
        if( !scoreFont->createTextureFromText( renderer, scoreText.str(), {0xFF,0xFF,0xFF,0xFF}))
        {
            printf( "Unable to render FPS texture!\n" );
        }
        
        //Clear screen
        SDL_SetRenderDrawColor( renderer, 0x00, 0x00, 0x00, 0x00 );
        SDL_RenderClear( renderer );
        
        //Apply the image
        SDL_RenderCopy( renderer, backgroundTex, NULL, NULL );
        SDL_SetRenderDrawBlendMode( renderer, SDL_BLENDMODE_BLEND );
        
        // Draw text
        fillRect = {0, 0, scoreFont->getWidth(), scoreFont->getHeight() };
        scoreFont->render(renderer, 40, 100, &fillRect);
        
        // displays jewels on board
        for (usint i=0; i<GRIDSIZE; i++)
        {
            for (usint j=0; j<GRIDSIZE; j++)
            {
                mArray[i][j].handleEvent( &e );
开发者ID:RicardoCoutinho,项目名称:GemsArr,代码行数:67,代码来源:SDLApp.cpp

示例5: main

int main( int argc, char* args[] )
{
	//Start up SDL and create window
	if( !init() )
	{
		printf( "Failed to initialize!\n" );
	}
	else
	{
		//Load media
		if( !loadMedia() )
		{
			printf( "Failed to load media!\n" );
		}
		else
		{	
			//Main loop flag
			bool quit = false;

			//Event handler
			SDL_Event e;

			//Set text color as black
			SDL_Color textColor = { 0, 0, 0, 255 };

			//The application timer
			LTimer timer;

			//In memory text stream
			std::stringstream timeText;

			//While application is running
			while( !quit )
			{
				//Handle events on queue
				while( SDL_PollEvent( &e ) != 0 )
				{
					//User requests quit
					if( e.type == SDL_QUIT )
					{
						quit = true;
					}
					//Reset start time on return keypress
					else if( e.type == SDL_KEYDOWN )
					{
						//Start/stop
						if( e.key.keysym.sym == SDLK_s )
						{
							if( timer.isStarted() )
							{
								timer.stop();
							}
							else
							{
								timer.start();
							}
						}
						//Pause/unpause
						else if( e.key.keysym.sym == SDLK_p )
						{
							if( timer.isPaused() )
							{
								timer.unpause();
							}
							else
							{
								timer.pause();
							}
						}
					}
				}

				//Set text to be rendered
				timeText.str( "" );
				timeText << "Seconds since start time " << ( timer.getTicks() / 1000.f ) ; 

				//Render text
				if( !gTimeTextTexture.loadFromRenderedText( timeText.str().c_str(), textColor ) )
				{
					printf( "Unable to render time texture!\n" );
				}

				//Clear screen
				SDL_SetRenderDrawColor( gRenderer, 0xFF, 0xFF, 0xFF, 0xFF );
				SDL_RenderClear( gRenderer );

				//Render textures
				gStartPromptTexture.render( ( SCREEN_WIDTH - gStartPromptTexture.getWidth() ) / 2, 0 );
				gPausePromptTexture.render( ( SCREEN_WIDTH - gPausePromptTexture.getWidth() ) / 2, gStartPromptTexture.getHeight() );
				gTimeTextTexture.render( ( SCREEN_WIDTH - gTimeTextTexture.getWidth() ) / 2, ( SCREEN_HEIGHT - gTimeTextTexture.getHeight() ) / 2 );

				//Update screen
				SDL_RenderPresent( gRenderer );
			}
		}
	}

	//Free resources and close SDL
	close();

//.........这里部分代码省略.........
开发者ID:JerelynCo,项目名称:CS179.14,代码行数:101,代码来源:23_advanced_timers.cpp

示例6: main

int main( int argc, char* args[] ) {
  //Start up SDL and create window
  if( !init() ) {
    printf( "Failed to initialize!\n" );
  } else {
    //Load media
    if( !loadMedia() ) {
      printf( "Failed to load media!\n" );
    } else {
      //Main loop flag
      bool quit = false;

      //Event handler
      SDL_Event e;

      //The dot that will be moving around on the screen
      Dot dot;

      //Keeps track of time between steps
      LTimer stepTimer;

      //While application is running
      while( !quit ) {
        //Handle events on queue
        while( SDL_PollEvent( &e ) != 0 ) {
          //User requests quit
          if( e.type == SDL_QUIT ) {
            quit = true;
          }

          //Handle input for the dot
          dot.handleEvent( e );
        }

        //Calculate time step
        float timeStep = stepTimer.getTicks() / 1000.f;

        //Move for time step
        dot.move( timeStep );

        //Restart step timer
        stepTimer.start();

        //Clear screen
        SDL_SetRenderDrawColor( gRenderer, 0xFF, 0xFF, 0xFF, 0xFF );
        SDL_RenderClear( gRenderer );

        //Render dot
        dot.render();

        //Update screen
        SDL_RenderPresent( gRenderer );
      }
    }
  }

  //Free resources and close SDL
  close();

  return 0;
}
开发者ID:kaprikawn,项目名称:sdl-starter,代码行数:61,代码来源:44_frame_independent_movement.cpp

示例7: main

int main( int argc, char* args[] ){
	//Start up SDL and create window
	if(!init()){
		printf( "Failed to initialize!\n" );
	}
	else{
		//Load media
		if(!loadMedia()){
			printf( "Failed to load media!\n" );
		}
		else{	
			//Main loop flag
			bool quit = false;

			//Event handler
			SDL_Event e;

			//In memory text stream
			stringstream timeText;

			//Start global timer
			gTimer.start();

			//The frames per second timer
			LTimer fpsTimer;

			//Start counting frames per second
			int countedFrames = 0;
			fpsTimer.start();

			//Count of balls in screen
			int nBalls = 4;

			//Set text color as black
			SDL_Color textColor = {0, 0, 0, 255};

			//loadBalls in vector gBalls
			loadBalls(nBalls);

			//While application is running
			while(!quit){
				//Handle events on queue
				while(SDL_PollEvent(&e) != 0){
					//User requests quit
					if(e.type == SDL_QUIT){
						quit = true;
					}
				}

				//Clear screen
				SDL_SetRenderDrawColor(gRenderer, 0xFF, 0xFF, 0xFF, 0xFF);
				SDL_RenderClear(gRenderer);

				//The ball in the center of the screen to which all other ball collides with
				Ball ball(SCREEN_WIDTH/2, SCREEN_HEIGHT/2, 0, 0);
				ball.render();
				
				//Calculate and correct fps
				float avgFPS = countedFrames/(fpsTimer.getTicks()/1000.f);
				if(avgFPS > 2000000){
					avgFPS = 0;
				}

				//Set text to be rendered
				timeText.str("");
				timeText << "Average Frames Per Second " << avgFPS; 

				//Render text
				if(!gFPSTextTexture.loadFromRenderedText(timeText.str().c_str(), textColor)){
					printf("Unable to render FPS texture!\n");
				}
				gFPSTextTexture.render((SCREEN_WIDTH-gFPSTextTexture.getWidth())/2, 0);

				//Move and render the balls inside the vector gBalls
				for(int i = 0; i < nBalls; i++){
					//bug: Needs to include all the balls inside the gBalls for the move method
					gBalls.at(i).move(ball.getCollider());
					gBalls.at(i).render();
				}

				//Update screen
				SDL_RenderPresent(gRenderer);
				++countedFrames;

			}
		}
	}

	//Free resources and close SDL
	close();

	return 0;
}
开发者ID:JerelynCo,项目名称:CS179.14,代码行数:93,代码来源:bouncingBall.cpp

示例8: main

int main( int argc, char* args[] )
{
	//Start up SDL and create window
	if( !init() )
	{
		printf( "Failed to initialize!\n" );
	}
	else
	{
		//Load media
		if( !loadMedia() )
		{
			printf( "Failed to load media!\n" );
		}
		else
		{	
			//Main loop flag
			bool quit = false;

			//Event handler
			SDL_Event e;

			//Set text color as black
			SDL_Color textColor = { 0, 0, 0, 255 };

			//The frames per second timer
			LTimer fpsTimer;

			//In memory text stream
			std::stringstream timeText;

			//Start counting frames per second
			int countedFrames = 0;
			fpsTimer.start();

			//While application is running
			while( !quit )
			{
				//Handle events on queue
				while( SDL_PollEvent( &e ) != 0 )
				{
					//User requests quit
					if( e.type == SDL_QUIT )
					{
						quit = true;
					}
				}

				//Calculate and correct fps
				float avgFPS = countedFrames / ( fpsTimer.getTicks() / 1000.f );
				if( avgFPS > 2000000 )
				{
					avgFPS = 0;
				}
				
				//Set text to be rendered
				timeText.str( "" );
				timeText << "Average Frames Per Second " << avgFPS; 

				//Render text
				if( !gFPSTextTexture.loadFromRenderedText( timeText.str().c_str(), textColor ) )
				{
					printf( "Unable to render FPS texture!\n" );
				}

				//Clear screen
				SDL_SetRenderDrawColor( gRenderer, 0xFF, 0xFF, 0xFF, 0xFF );
				SDL_RenderClear( gRenderer );

				//Render textures
				gFPSTextTexture.render( ( SCREEN_WIDTH - gFPSTextTexture.getWidth() ) / 2, ( SCREEN_HEIGHT - gFPSTextTexture.getHeight() ) / 2 );

				//Update screen
				SDL_RenderPresent( gRenderer );
				++countedFrames;
			}
		}
	}

	//Free resources and close SDL
	close();

	return 0;
}
开发者ID:cvg256,项目名称:SDLTestGame,代码行数:84,代码来源:24_calculating_frame_rate.cpp

示例9: main


//.........这里部分代码省略.........

		anim++;
		if(anim == 420)
			anim = 0;

//	//	// RENDERING // // //         //	//	// RENDERING // // //  	//	//	// RENDERING // // //  //	//	// RENDERING // // //   //	//	// RENDERING // // //  

			SDL_Color textColor = { 0xff, 0x00, 0xBA }; 
			SDL_Rect textRect = {200, 0, 64, 32};
			char* pScore = new char[6];
			sprintf(pScore, "%d", player.score);
			std::string pScoreStr;
			for(int i = 0; i < 3; ++i)	
			{
				pScoreStr.push_back(pScore[i]);
			}
			scoreTex.loadFromRenderedText("SCORE :  " + pScoreStr, textColor, game.getRenderer(), menu.font);

			SDL_SetRenderDrawColor( game.getRenderer(), 0x00, 0x00, 0x00, 0x00 );
			SDL_RenderClear( game.getRenderer() );
			


			//"SCORE :  " + pScoreStr



			for(int i = 0; i < 400; i++) {
				//printf( "%d = %d \n ", i, tiles[i]->getType());
				tiles[i]->show(game.getRenderer());
			}

		
			for( int i = 0; i < coins.size(); ++i)
			{
				coins[i].show( game.getRenderer() );
			}

			for (int i = 0; i < 4; i++){
				ghosts[i]->render(game.getRenderer());
			}


			bool pace = anim % 20 > 10; 

			if(player.CurrentDirection == MovementLeft || player.CurrentDirection == MovementRight)
			{
				if(pace)
				{
					player.setPlayerTex(&playerTextures[0]);
				}
				else
				{
					player.setPlayerTex(&playerTextures[1]);
				}
				if(player.CurrentDirection == MovementRight)
					player.render(game.getRenderer(), SDL_FLIP_NONE , 32, 32);
				if(player.CurrentDirection == MovementLeft)
					player.render(game.getRenderer(), SDL_FLIP_HORIZONTAL , 32, 32);
			}

			if(player.CurrentDirection == MovementDown || player.CurrentDirection == MovementUp)
			{
				if(pace)
				{
					player.setPlayerTex(&playerTextures[2]);
				}
				else
				{
					player.setPlayerTex(&playerTextures[3]);
				}
				if(player.CurrentDirection == MovementUp)
					player.render(game.getRenderer(), SDL_FLIP_NONE , 32, 32);
				if(player.CurrentDirection == MovementDown)
					player.render(game.getRenderer(), SDL_FLIP_VERTICAL , 32, 32);
			}

			//SpriteSheetTexture.NewRender(player.playerBox.x, player.playerBox.y, currentClip, gRenderer);
			scoreTex.render(0, 0, game.getRenderer(), SDL_FLIP_NONE, 150, 40);
			SDL_RenderPresent( game.getRenderer() );

			float avgFPS = countedFrames / ( fpsTimer.getTicks() / 1000.f );
			if( avgFPS > 2000000 )
			{
				avgFPS = 0;
			}
			++countedFrames;

			int frameTicks = capTimer.getTicks();
			if( frameTicks < gameEEN_TICK_PER_FRAME )
			{
				SDL_Delay( gameEEN_TICK_PER_FRAME - frameTicks );
			}

	}
	
	
	//system("pause");
	return 0;
}
开发者ID:nbudinov,项目名称:Game-Dev-Summer-2014,代码行数:101,代码来源:main.cpp

示例10: start

int Saloon::start() {
	if(_window != nullptr) {

		// Create an OpenGL context associated with the window.
		SDL_GLContext glContext = SDL_GL_CreateContext(_window);

		// Init and check for GL Errors.
		glInit(_displayWidth, _displayHeight);

		GLenum error = glGetError();
		if( error != GL_NO_ERROR )
		{
			logSDLError(std::cout, "GL INIT");
			return 1;
		}

		LTimer fpsTimer;
		fpsTimer.start();
		Uint32 frames = 0, FPS = 0;

		//Our event structure
		SDL_Event e;
		bool quit = false;

		int curTime, prevTime = SDL_GetTicks();

		BMFont debugFont("Fonts/system16.fnt");

		onCreate();


		while (!quit){

			while (SDL_PollEvent(&e)){
				if (e.type == SDL_QUIT)
					quit = true;
				//Use number input to select which clip should be drawn
				if (e.type == SDL_KEYDOWN){
					switch (e.key.keysym.sym){
						case SDLK_ESCAPE:
							quit = true;
							break;
						case SDLK_TAB:
							if(_debugEnabled) {
								setVSyncEnabled(false);
							}
							break;
						default:
							break;
					}
				}
				else if(e.type == SDL_KEYUP) {
					switch (e.key.keysym.sym){
						case SDLK_TAB:
							if(_debugEnabled) {
								setVSyncEnabled(true);
							}
							break;
						default:
							break;
					}
				}
			}

			if(_debugEnabled) {
				debugStart();

				curTime = SDL_GetTicks();

				deltaTime = (curTime - prevTime) / 1000.0f;

				prevTime = curTime;

				if(fpsTimer.getTicks() >= 1000) {
					FPS = frames;
					frames = 0;
					fpsTimer.reset();
				}

				frames++;

				debugWatch("FPS", FPS);
			}

			onUpdate();

			glClear(GL_COLOR_BUFFER_BIT);

			//Reset modelview matrix
			glMatrixMode( GL_MODELVIEW );
			glLoadIdentity();

			glPushMatrix();

			glTranslatef(_halfDisplayWidth, _halfDisplayHeight, 0.0f);

			glPushMatrix();
			// Camera transformations
			glScalef(_camZoom, _camZoom, 1.0f);
			glRotatef(_camAng, 0, 0, 1);
//.........这里部分代码省略.........
开发者ID:jimhub,项目名称:saloon-engine,代码行数:101,代码来源:Saloon.cpp

示例11: main

int main(int argc, char **argv) {

	// Init all SDl stuff

	SDL_Routine SDL_hdl;
	if (SDL_hdl.InitSDL()) {
		logSDLError(std::cout, "SDL Init");
		return 1;
	}

	SDL_Texture *bg = loadTexture("res/bg.png", SDL_hdl.Render);
	Character Alice;

	Alice.loadTex("res/Alice_spritesheet.png", SDL_hdl.Render);

	if (bg == nullptr || Alice.char_tex == nullptr)
			return 4;

	const Uint8 *keys = SDL_GetKeyboardState(nullptr);


	// Main Loop

	Mix_Music *bg_mus = loadBGMusic("res/bg.mp3");
	playBGMusic(bg_mus);
	bool mus_status = true;

	SDL_Event e;
	bool show_fps = true;
	bool quit = false;

	TTF_Font* fps_font = openFont("res/beau.ttf", 25);
	SDL_Color textColor = {0, 0, 0};

	std::stringstream fps_text;
	SDL_Texture* txt_image;
	//SDL_Texture* txt_image = renderText("FPS test text", fps_font, textColor, renderer);
	//if (txt_image == nullptr) {
	//	return 1;
	//}

	LTimer fpsTimer;
	int countedFrames = 0;
	std::stringstream fpsText;
	float avgFPS = 0;

	fpsTimer.start();


	while (!quit) {

		SDL_RenderClear(SDL_hdl.Render);

		int bW, bH;
		SDL_QueryTexture(bg, NULL, NULL, &bW, &bH);

		// Calculate FPS
		avgFPS = countedFrames / ( fpsTimer.getTicks() / 1000.f );
		if ( avgFPS > 2000000 )
			avgFPS = 0;
		fps_text.str("");
		fps_text << "FPS: " << avgFPS;

		// Render BG
		SDL_Rect bg_box;
		bg_box.x = 0;
		bg_box.y = 0;
		bg_box.w = SCREEN_WIDTH;
		bg_box.h = SCREEN_HEIGHT;
		renderTexture(bg, SDL_hdl.Render, bg_box, nullptr);

		// Show FPS
		if (show_fps) {
			txt_image = renderText(fps_text.str().c_str(), fps_font, textColor, SDL_hdl.Render);
			if (txt_image == nullptr) {
				return 1;
			}
		}

		//SDL_PumpEvents();
		if (SDL_PollEvent(&e)) {
			if (e.type == SDL_QUIT)
				quit = true;
			if (e.type == SDL_MOUSEBUTTONDOWN)
				quit = true;
		}

		if (keys[SDL_SCANCODE_LEFT]) {
			Alice.direction_state = 6;
			Alice.anim_frame = Alice.frame / 4;
			if (Alice.char_box.x > 0)
				Alice.char_box.x -= VELOCITY;
		}
		if (keys[SDL_SCANCODE_RIGHT]) {
			Alice.direction_state = 2;
			Alice.anim_frame = Alice.frame / 4;
			if (Alice.char_box.x <= (SCREEN_WIDTH - SPRITE_SIZE * 3))
				Alice.char_box.x += VELOCITY;
		}
		if (keys[SDL_SCANCODE_UP]) {
//.........这里部分代码省略.........
开发者ID:zagevalo,项目名称:SDL2_tut,代码行数:101,代码来源:SDL2_tut.cpp

示例12: main

int main(int argc, char* args[])
{

    if (!init())
    {
        printf("Failed to initialize!\n");
    }
    else
    {
        if (!loadMedia())
        {
            printf("Failed to load media!\n");
        }
        else
        {
            bool quit = false;
            SDL_Event e;
            LTexture word;
            SDL_Color textColor = { 0, 0, 0, 255 };
            std::stringstream timeText;
            LButton* ptrButton[NUMBER_OF_BUTTON];
            for (int i = 0; i < NUMBER_OF_BUTTON; ++i)
            {
                ptrButton[i] = &gButton[i];
            }

            bool temp[NUMBER_OF_BUTTON] = { false };

            while (!quit)
            {
                while (SDL_PollEvent(&e) != 0)
                {
                    if (e.type == SDL_QUIT)
                    {
                        quit = true;
                    }
                    for (int i = 0; i < NUMBER_OF_BUTTON; ++i)
                    {
                        temp[i] = ptrButton[i]->handleEvent(e);
                    }

                    for (int i = 0; i < NUMBER_OF_TILE * 4; i++)
                    {
                        gTile[i].handleEvent(e);
                    }

                    //Handle window events
                    gWindow.handleEvent(e);
                    if (gWindow.isMinimized())
                    {
                        gTimer.pause();
                    }
                    else
                    {
                        gTimer.unpause();
                    }
                }

                logicButtons(temp);



//                for (int i = 0; i < 5; ++i){
//                    for (int g = 0; g < 6; ++g){
//                        board.unblock(i, g);
//                    }
//                }
//                for (int i = 0; i < 5; ++i){
//                    for (int g = 0; g < 6; ++g){
//                        board.unblock(i, g);
//                    }
//                }

                if (!gWindow.isMinimized())
                {
                    SDL_SetRenderDrawColor(gRenderer, 0xFF, 0xFF, 0xFF, 0xFF);
                    SDL_RenderClear(gRenderer);
                    renderTexture(&gSceneTexture, 0, 0, gWindow.getWidth(),
                                  gWindow.getHeight());

                    for (int i = 0; i < NUMBER_OF_BUTTON; ++i)
                    {
                        ptrButton[i]->setPosition(650, 50 + 40 * i);
                        ptrButton[i]->renderButton();
                    }
                    timeText.str("");
                    timeText << "Time: " << std::fixed << std::setprecision(1)
                             << (gTimer.getTicks() / 1000.f);
                    //Render text
                    if (!word.loadFromRenderedText(timeText.str().c_str(),
                                                   textColor))
                    {
                        printf("Unable to render time texture!\n");
                    }
                    word.render(20, 550);



                    if (gPtrHelp == NULL)
                    {
//.........这里部分代码省略.........
开发者ID:NASD-Bulgaria,项目名称:egt-training,代码行数:101,代码来源:main.cpp


注:本文中的LTimer::getTicks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。