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


C++ TextInput::setTextDst方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........
                   rocketVec2[i]->cleanObject(screen);
                   rocketVec2[i]->drawObject(screen, bground);
               }
           }

        //Redraw Meteor objects.
        for(unsigned i = 0; i < meteorVec.size(); i++) {
        	meteorVec[i]->moveObject();
        	meteorVec[i]->isColision(meteorVec);
        	meteorVec[i]->cleanObject(screen);
        	meteorVec[i]->drawObject(screen, bground);
        }

        //Redraw Bonus objects.
        for(unsigned i = 0; i < bonusVec.size(); i++) {
        	bonusVec[i]->moveObject();
        	bonusVec[i]->cleanObject(screen);
        	bonusVec[i]->drawObject(screen, bground);
        }

        //tt->setTextRender("TIME: ", tb.getTicks()/1000.f );
        //tt->setTextRender("TIME: ", startTime);

        //Redraw text fields.
        scoreTxt->cleanText(screen);
        scoreTxt->drawText(screen);
        bulletTxt->cleanText(screen);
        bulletTxt->drawText(screen);
        if(bonus==true){rocketTxt->cleanText(screen);
        rocketTxt->drawText(screen);}
        livesTxt->cleanText(screen);
        livesTxt->drawText(screen);
//      tt->cleanText(screen);
//      tt->drawText(screen);

		SDL_UpdateRect(screen, 0, 0, 0, 0);
		if(LIVES == 0) break; //If the game is over.

		if((fps.getTicks() < 1000/FRAMES_PER_SECOND)) {
		    //Sleep the remaining frame time
		    SDL_Delay((300 /FRAMES_PER_SECOND) - fps.getTicks());
		}


	} // End Game

	TextInput* name = new TextInput();
	name->setTextDst(270, 120, 100, 30);
	msgTxt->drawText(screen);
	while(true) {
	    if(SDL_PollEvent(&event)) {
	        name->handleInput(event);
	    	if((event.type == SDL_KEYDOWN ) && (event.key.keysym.sym == SDLK_RETURN)) {
	    		msgTxt->setTextDst(260, 190, 100, 30);
	    		msgTxt->setTextRender(name->getStr().append(" : "), SCORE);
	    		msgTxt->drawText(screen);
	    		break;
	    	}
	    }
	    name->drawText(screen);
	    SDL_UpdateRect(screen, 0, 0, 0, 0);
	}
	gameTxt->drawText(screen);
	SDL_UpdateRect(screen, 0, 0, 0, 0);
	SDL_Delay(3000);

	//Cleanup.
	delete scoreTxt;
	delete bulletTxt;
	delete rocketTxt;
	delete livesTxt;
	delete gameTxt;
	delete msgTxt;
	delete name;
//	delete tt;
	delete objShip;

	for(unsigned i = 0; i < meteorVec.size(); i++) {
	        delete meteorVec[i];
	}
	for(unsigned i = 0; i < bonusVec.size(); i++) {
	        delete bonusVec[i];
	}

	for(unsigned i = 0; i < bulletVec.size(); i++) {
	        delete bulletVec[i];
    }
	for(unsigned i = 0; i < rocketVec.size(); i++) {
		    delete rocketVec[i];
	}
	for(unsigned i = 0; i < rocketVec2.size(); i++){
			delete rocketVec2[i];
	}

	SDL_FreeSurface(bground);
	SDL_FreeSurface(screen);
	SDL_Quit();

	return 0;
}//End of Main.
开发者ID:NCSU,项目名称:Asteroid-Field-Game,代码行数:101,代码来源:AsteroidField.cpp


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