本文整理汇总了C++中Foo::show方法的典型用法代码示例。如果您正苦于以下问题:C++ Foo::show方法的具体用法?C++ Foo::show怎么用?C++ Foo::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Foo
的用法示例。
在下文中一共展示了Foo::show方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Foo w;
w.show();
return a.exec();
}
示例2: main
int main()
{
string s = "bar";
Foo *f = new Foo(2, &s);
Foo f2;
Bar *b1 = new Bar();
std::unique_ptr<Bar> b2(new Bar(2));
std::unique_ptr<Bar> b3(new Bar(3));
b1->show();
Bar b4;
f->show();
test_vclass();
int integer;
std::shared_ptr<Bar> b5(new Bar(77));
b5->show();
#if 0
// demonstrate rtti
// use typeid to test type equality
cout << "typeid name: " << typeid(f).name() << endl;
cout << "typeid name: " << typeid(f2).name() << endl;
cout << "typeid name: " << typeid(b).name() << endl;
cout << "typeid name: " << typeid(b2).name() << endl;
cout << "typeid name: " << typeid(integer).name() << endl;
cout << "typeid name: " << typeid(int).name() << endl;
if (typeid(*f) == typeid(*b)) {
cout << "foo and bar are the same type." << endl;
}
if (typeid(f2) == typeid(*f)) {
cout << "f2 and f are the same types" << endl;
}
if (typeid(b2) == typeid(*b)) {
cout << "b2 and b are the same types" << endl;
}
if (typeid(integer) == typeid(int)) {
cout << "integer is an int type" << endl;
}
// use dynamic cast to see if classes are related
Derived *d = new Derived();
if (dynamic_cast<Base*>(d)) {
cout << "Derived is subclass of Base" << endl;
}
// test template
Template<string> *t1 = new Template<string>("bart");
Template<int> *t2 = new Template<int>(777);
t1->show();
t2->show();
#endif
}
示例3: main
//Functions
int main(int argc, char* args[])
{
bool quit = false;
if(init() == false)
{
return 1;
}
//Load the files
if(load_files() == false)
{
return 1;
}
set_clips();
Timer fps;
Foo walk;
//While user hasn't quit
while(quit == false)
{
fps.start();
while(SDL_PollEvent(&event))
{
walk.handle_events();
if(event.type == SDL_QUIT)
{
quit = true;
}
}
walk.move();
SDL_FillRect(screen, &screen->clip_rect, SDL_MapRGB(screen->format, 0xFF, 0xFF, 0xFF));
walk.show();
if(SDL_Flip(screen) == -1)
{
return 1;
}
if(fps.get_ticks() < 1000 / FRAMES_PER_SECOND)
{
SDL_Delay((1000 / FRAMES_PER_SECOND) - fps.get_ticks());
}
}
clean_up();
return 0;
}
示例4: main
int main( int argc, char* args[] )
{
//Quit flag
bool quit = false;
//Initialize
if( init() == false )
{
return 1;
}
//Load the files
if( load_files() == false )
{
return 1;
}
//Clip the sprite sheet
set_clips();
//The frame rate regulator
Timer fps;
//The stick figure
Foo walk;
//While the user hasn't quit
while( quit == false )
{
//Start the frame timer
fps.start();
//While there's events to handle
while( SDL_PollEvent( &event ) )
{
//Handle events for the stick figure
walk.handle_events();
//If the user has Xed out the window
if( event.type == SDL_QUIT )
{
//Quit the program
quit = true;
}
}
//Move the stick figure
walk.move();
//Fill the screen white
SDL_FillRect( screen, &screen->clip_rect, SDL_MapRGB( screen->format, 0xFF, 0xFF, 0xFF ) );
//Show the stick figure on the screen
walk.show();
//Update the screen
if( SDL_Flip( screen ) == -1 )
{
return 1;
}
//Cap the frame rate
if( fps.get_ticks() < 1000 / FRAMES_PER_SECOND )
{
SDL_Delay( ( 1000 / FRAMES_PER_SECOND ) - fps.get_ticks() );
}
}
//Clean up
clean_up();
return 0;
}
示例5: dino_main
void dino_main()
{
start= SDL_GetTicks();
for(int i=0; i<600; i++)
{
randx[i]= rand()%600 + 1;
randy[i]= rand()%420 + 1;
if (randy[i]>220 && randy[i]<270)
{
randx[i]=randx[i-1];
randy[i]=randx[i-1];
}
}
bool quit = false;
set_clips();
//The frame rate regulator
Timer fps;
//The stick figure
Foo walk;
//While the user hasn't quit
while( quit == false )
{
//Start the frame timer
fps.start();
//While there's events to handle
while( SDL_PollEvent( &event ) )
{
//Handle events for the stick figure
walk.handle_events();
//If the user has Xed out the window
if( event.type == SDL_QUIT )
{
//Quit the program
quit = true;
}
}
//Move the stick figure
walk.move(randx,randy);
//Fill the screen white
//SDL_FillRect( screen, &screen->clip_rect, SDL_MapRGB( screen->format, 0, 0xFF, 0xFF ) );
apply_surface(0,0,back_grass,screen);
score_dis = TTF_RenderText_Solid( font, "Score", textColor );
apply_surface( 460, 450, score_dis, screen );
SDL_FillRect( screen, &wall, SDL_MapRGB( screen->format, 0, 0xFF, 0xFF ) );
SDL_FillRect( screen, &wall2, SDL_MapRGB( screen->format, 0, 0xFF, 0xFF ));
walk.show();
//Update the screen
if( SDL_Flip( screen ) == -1 )
{
}
//Cap the frame rate
if( fps.get_ticks() < 1000 / FRAMES_PER_SECOND )
{
SDL_Delay( ( 1000 / FRAMES_PER_SECOND ) - fps.get_ticks() );
}
}
}