本文整理汇总了C++中Dot::change_heading方法的典型用法代码示例。如果您正苦于以下问题:C++ Dot::change_heading方法的具体用法?C++ Dot::change_heading怎么用?C++ Dot::change_heading使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dot
的用法示例。
在下文中一共展示了Dot::change_heading方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main ( int argc, char** argv )
{
Setup setup1;
//cerr << "address of Setup: " << &setup1 << '\n';
ImageManager im1;
SoundManager sm1;
Dot myDot;
World world1;
cout << "rest of main \n";
if(setup1.init() == false)
{
return 1;
}
//newScreen = setup1.getScreen();
if(im1.loadFont() == false)
{
return 1;
}
if(im1.getFiles() == false)
{
cout << "error loading images" << endl;
return 1;
}
if(sm1.soundFiles() == false)
{
cout << "error loading sounds \n";
return 1;
}
if(world1.set_tiles() == false)
{
cout << "error loading map \n";
return 1;
}
//Mix_Music* bgm = sm1.getTrack(0);
// make sure SDL cleans up before exit
atexit(SDL_Quit);
// centre the bitmap on screen
//SDL_Rect dstrect;
//dstrect.x = (screen->w - bmp->w) / 2;
//dstrect.y = (screen->h - bmp->h) / 2;
Timer frames1;
Timer delta;
delta.start();
// program main loop
bool done = false;
while (done == false)
{
frames1.start();
// message processing loop
SDL_Event event;
while (SDL_PollEvent(&event))
{
//cout << &event << endl;
//SDL_Event *e = &event;
myDot.change_heading(event);
myDot.handle_input(event);
if(event.type == SDL_QUIT)
{
done = true;
}
// get keystates
//Uint8 *keystates = SDL_GetKeyState(NULL);
if(event.type == SDL_KEYDOWN)
{
if(event.key.keysym.sym == SDLK_p)
{
if(Mix_PlayingMusic() == 0)
{
sm1.playAll();
}
else
{
if(Mix_PausedMusic() == 1)
{
Mix_ResumeMusic();
}
else
{
Mix_PauseMusic();
}
}
}
if(event.key.keysym.sym == SDLK_ESCAPE)
{
done = true;
//.........这里部分代码省略.........