本文整理汇总了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.