本文整理汇总了C++中Cube::Move方法的典型用法代码示例。如果您正苦于以下问题:C++ Cube::Move方法的具体用法?C++ Cube::Move怎么用?C++ Cube::Move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cube
的用法示例。
在下文中一共展示了Cube::Move方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WndProc
LRESULT WINAPI WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_KEYDOWN:
switch (wParam)
{
case VK_UP:
cube.Move(-delta, TETHA);
break;
case VK_DOWN:
cube.Move(delta, TETHA);
break;
case VK_LEFT:
cube.Move(delta, PHI);
break;
case VK_RIGHT:
cube.Move(-delta, PHI);
break;
}
break;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, msg, wParam, lParam);
}
示例2: main
int main()
{
RessourceManager &rsm = nsHanoi :: RessourceManager :: getInstance();
rsm.Initialize_All_Cubes();
sf::RenderWindow window(sf::VideoMode(800, 600), "xX_HanoiCube_Xx", sf::Style::Default, sf::ContextSettings(32));
window.setVerticalSyncEnabled(true);
Cube Pave = Cube(Point(6, 5, 5), Point(6, 6, 5),
Point(5, 5, 5), Point(6, 5, 5.5));
const sf::Time timePerFrame = sf::seconds(1.f / 60.f); //60fps
sf::Clock clock;
unsigned Cpt = 0;
bool running = true;
while (running)
{
sf::Event event;
while (window.pollEvent(event))
{
clock.restart();
if (event.type == sf::Event::Closed)
{
running = false;
}
else if (event.type == sf::Event::Resized)
{
#ifdef GRENABLED
glViewport(0, 0, event.size.width, event.size.height);
#endif
}
}
#ifdef GRENABLED
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective(90,(double)640/480,1,1000);
glEnable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
rsm.setView();
rsm.RenderAll();
#endif
if (Cpt < 100)
{
Pave.Move(0.01, 0, 0);
++Cpt;
}
else if(Cpt >= 100 && Cpt < 200)
{
Pave.Move(0, 0, 0.01);
++Cpt;
}
window.display();
while (clock.getElapsedTime () < timePerFrame)
sf::sleep (sf::milliseconds (1));
}
return 0;
}