本文整理汇总了C++中Turtle::setAngle方法的典型用法代码示例。如果您正苦于以下问题:C++ Turtle::setAngle方法的具体用法?C++ Turtle::setAngle怎么用?C++ Turtle::setAngle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Turtle
的用法示例。
在下文中一共展示了Turtle::setAngle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
SDL_Event event;
SDL_TimerID Update = SDL_AddTimer(500,UpdateIteration,&lsystems);
while(quit!=true)
{
while( SDL_PollEvent(&event) != 0)
{
if(event.type == SDL_QUIT)
{
quit=true;
}
//If esc pressed exit window
if(event.type == SDL_KEYDOWN)
{
switch (event.key.keysym.sym)
{
case SDLK_ESCAPE:
{
quit=true; break;
}
// if 1 is pressed draw 1st tree type
case SDLK_1:
{
lsystems.selectTree(1);lsystems.m_iterations=0; break;
}
// if 2 is pressed draw 2ns tree type
case SDLK_2:
{
lsystems.selectTree(2); lsystems.m_iterations=0 ; break;
}
// press up to increase angle
case SDLK_UP:
{
turtle.m_angle+=5; break;
}
// press down to decrease angle
case SDLK_DOWN:
{
turtle.m_angle -=5; break;
}
// if right pressed increase max increments (max growth)
case SDLK_RIGHT:
{
lsystems.m_maxIterations+=1; lsystems.m_iterations=0; break;
}
// if left pressed decrease max increments (min graowth)
case SDLK_LEFT:
{
lsystems.m_maxIterations-=1; lsystems.m_iterations=0; break;
}
default:
{
break;
}
}
}
}
scene->drawScene();
//lsystems.createLeaf();
lsystems.setAxiom();
lsystems.setRule();
lsystems.setAlphabet();
lsystems.setAlphabetRule();
turtle.setAngle(turtle.m_angle);
// number of iterations
lsystems.productions(lsystems.m_iterations);
lsystems.getDrawingRule();
// width and height. width increases with each iteration
turtle.Draw(lsystems,lsystems.m_iterations*0.008,0.20);
SDL_GL_SwapWindow( window);
}
// Delete our scene
delete scene;
//Destroy window
SDL_DestroyWindow( window );
// Disable our timer
SDL_RemoveTimer(Update);
//Quit SDL subsystems
SDL_Quit();
return EXIT_SUCCESS;
}