本文整理汇总了C++中Video::drawText方法的典型用法代码示例。如果您正苦于以下问题:C++ Video::drawText方法的具体用法?C++ Video::drawText怎么用?C++ Video::drawText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Video
的用法示例。
在下文中一共展示了Video::drawText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
allegro_init();
install_keyboard();
try
{
ImageLoader::setLoader(new ImageLoaderMagick());
Video::init("Teste da classe Image");//iniciamos a classe de vídeo
Video video = Video::get();//pegamos um ponteiro para classe de vídeo para mais fácil acesso
int angle1 = 0;
int angle2 = 255;
//criamos 2 imagens de 50 x 30
Image normal(50,30);
Image normal1(50,30);
normal.drawText("Teste",0,0,makecol(0,0,255)); //desenhamos o texto Teste de azul na imagem
normal1.drawText("Teste",0,0,makecol(255,0,0)); //desenhamos o texto Teste de vermelho na imagem
while(!key[KEY_ESC])
{
video.clear();//limapamos o buffer do vídeo
video.drawImage(normal,50,50);
video.drawImage(normal1,150,50);
for(register int i = 0; i < 5; i++)
{
for(register int j = 0; j < 4; j++)
{
const int ang = ((i+j)%2) ? angle1 : angle2;
video.drawImageRoteted(normal1 ,80+i*40,70+j*40,ang );
video.drawImageRoteted(normal ,80+i*40,70+j*40,ang+128+64 );
video.drawImageRoteted(normal1 ,80+i*40,70+j*40,ang+128 );
video.drawImageRoteted(normal ,80+i*40,70+j*40,ang+64 );
}
}
video.drawText("Teste da classe Image.",10,0,makecol(255,255,255));
video.drawText(10,10,makecol(255,255,255),-1,"Angle : %d",angle1);
video.drawText(10,20,makecol(255,255,255),-1,"Angle2 : %d",angle2);
video.show();
angle1 += 2;
angle2 -= 2;
if(angle2 < 0) angle2=255;
if(angle1 >= 255) angle1=0;
}
}
catch(Exception& e)
{
cout << e.getMessage() << endl;
}
return 0;
}END_OF_MAIN()
示例2: main
int main()
{
allegro_init();
install_keyboard();
try
{
ImageLoader::setLoader(new ImageLoaderMagick());
Video::init("Teste da classe Sprite");
Video video = Video::get();
Sprite normal(Image("../resources/pcx24bits.pcx"),0,0,12,47);
normal.save("sprite.gspr");
Sprite normal1("sprite.gspr");
int angle1 = 0;
int angle2 = 0;
while(!key[KEY_ESC])
{
video.clear();
for(int i=0; i<5; i++)
{
for(int j=0; j<4; j++)
{
int ang= ((i+j)%2) ? angle1 : angle2;
video.drawSpriteRoteted(normal1 ,80+i*40,70+j*40,ang );
video.drawSpriteRoteted(normal1 ,80+i*40,70+j*40,ang+128+64 );
video.drawSpriteRoteted(normal1 ,80+i*40,70+j*40,ang+128 );
video.drawSpriteRoteted(normal1 ,80+i*40,70+j*40,ang+64 );
}
}
//video->drawImageStretched(normal1,20,30,normal1.getWidth(),normal1.getHeight());
//video->drawImageStretched(normal2,20,90,normal2.getWidth(),normal2.getHeight());
// video->drawSpriteRoteted(normal1,80,80,angle1);
// video->drawSpriteRoteted(normal1,80,80,angle2);
video.drawText("Teste da classe Sprite.",10,0,makecol(255,255,255));
video.drawText(10,10,makecol(255,255,255),-1,"Angle1: %d",angle1);
video.drawText(10,20,makecol(255,255,255),-1,"Angle2: %d",angle2);
video.show();
angle1+=2;
angle2-=2;
if(angle2<0) angle2 = 255;
if(angle1>=255) angle1 = 0;
}
}
catch(Core::Exception& e)
{
cout << e.what();
}
return 0;
}
示例3: main
int main(int argc, char** argv)
{
allegro_init();
install_keyboard();
bool trans = false;
try
{
// ImageLoader::setLoader(new ImageLoaderMagick());
ImageLoader::setLoader(new ImageLoaderSDL());
ImageLoader::getLoader().setSaveFormat("PNG");
//ImageLoader::setLoader(new Gorgon::ImageLoaderAutodetect());
Video::init("Teste da classe SpritePack",1280,720);
Video video = Video::get();
SpritePack gspk;
if(argc > 2)
{
if(std::string(argv[1]).compare("-image") == 0)
{
gspk = SpriteSheet(Image(argv[2]),0xFF0000);
}
else if(std::string(argv[1]).compare("-spritepack") == 0)
{
gspk.load(argv[2]);
}
else if(std::string(argv[1]).compare("-sff") == 0)
{
gspk = SpritePackSff(std::string(argv[2]));
}
else if(std::string(argv[1]).compare("-script") == 0)
{
gspk = SpritePackLua(argv[2]);
}
else
{
printf("opções erradas!\n");
usageMSG();
return 0;
}
}
else
{
// gspk = SpritePackSff("~/mugen/Alucard/Alucard.sff");
gspk = SpritePackSff("/home/cantidio/mugen/Alucard/Alucard.sff");
/*usageMSG();
return 0;*/
}
showCommands();
Sprite buffer(Image(1280,720));
int counter = 0;
int onionIndex = 0;
while(!key[KEY_ESC])
{
buffer.clear();
buffer.drawSpriteTrans(gspk[onionIndex],Point(X,Y),0.5);
(trans) ? buffer.drawSprite(gspk[counter],Point(X,Y)) : buffer.blitSprite(gspk[counter],Point(X,Y));
buffer.drawRectangle(Point(X-1,Y-1),Point(X+1,Y+1),0xFFFFFF,true);//draw a hot spot
video.clear();
video.blitSpriteStretched(buffer,Point(-X * (zoom-1),-Y * (zoom-1)),zoom,zoom);
video.drawText("Gorgon SpritePack View",10,10,0xFFFFFF);
video.drawText(Point(10,30),0xFFFFFF,-1,"Width: %d",gspk[counter].getWidth());
video.drawText(Point(10,40),0xFFFFFF,-1,"Height: %d",gspk[counter].getHeight());
video.drawText(Point(10,50),0xFFFFFF,-1,"Group: %d",gspk[counter].getGroup());
video.drawText(Point(10,60),0xFFFFFF,-1,"Index: %d",gspk[counter].getIndex());
video.drawText(Point(10,70),0xFFFFFF,-1,"xOffset: %d",gspk[counter].getOffset().getX());
video.drawText(Point(10,80),0xFFFFFF,-1,"yOffset: %d",gspk[counter].getOffset().getY());
video.drawText(Point(10,90),0xFFFFFF,-1,"counter: %d",counter);
video.show();
if(key[KEY_LCONTROL])
{
if(key[KEY_S])
{
std::string file1;
std::string file2;
printf("Digite o nome do spritepack a ser salvo:\n");
cin >> file1;
file2 = file1;
file1.append(".lua");
file2.append(".gspk");
printf("salvando...");
SpritePackLua a(gspk);
a.save(file1);
gspk.save(file2);
printf("[ok]\n");
}
else if(key[KEY_T])
{
printf("trim sprite all\n");
for(int i = 0; i < gspk.getSize(); ++i)
{
gspk[i].clipNoBorder();
}
printf("%d sprites trimmed.\n",gspk.getSize());
//.........这里部分代码省略.........