本文整理汇总了C++中Physics::move方法的典型用法代码示例。如果您正苦于以下问题:C++ Physics::move方法的具体用法?C++ Physics::move怎么用?C++ Physics::move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Physics
的用法示例。
在下文中一共展示了Physics::move方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
glewExperimental = true;
GLenum err = glewInit();
// Failure check - Inititiating GLEW
if (GLEW_OK != err)
{
fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
}
else
{
fprintf(stderr, "GLEW initialized\n");
}
#ifdef _DEBUG
if (glDebugMessageCallback){
std::cout << "Register OpenGL debug callback " << std::endl;
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
glDebugMessageCallback((GLDEBUGPROC)openglCallbackFunction, nullptr);
GLuint unusedIds = 0;
glDebugMessageControl(GL_DONT_CARE,
GL_DONT_CARE,
GL_DONT_CARE,
0,
&unusedIds,
true);
}
else
{
std::cout << "glDebugMessageCallback not available" << std::endl;
}
#endif
// VSync
glfwSwapInterval(1);
////////////////////////////////////////////////////////////
// Engine classes
Graphics ge = Graphics();
Physics ph = Physics();
InitMeshes(&ge);
InitCameras();
ge.SetCamera(&cameras[cameraIndex]);
fpsCounter fpsC;
int tickCounter = 400;
////////////////////////////////////////////////////////////
while (!glfwWindowShouldClose(window))
{
std::stringstream ss;
ss << fpsC.get();
glfwSetWindowTitle(window, ss.str().c_str());
KeyEvents(window, &ge, &ph);
UpdateProjections(window);
RotateCamera(&cameras[cameraIndex], window);
MoveCamera(&cameras[cameraIndex], window);
if (fpsC.deltaTime() > 0 && tickCounter < 1)
{
//ph.move(&mustangHigh, &fpsC);
ph.move(&EndOfLine, &fpsC);
}
else
{
tickCounter--;
}
Collision(&EndOfLine, &target);
Collision(&EndOfLine, &target2);
ge.PrepareRender();
ge.Render(&mustang);
ge.Render(&mustang2);
ge.Render(&mustang3);
ge.Render(&mustang4);
ge.Render(&mustangHigh);
ge.Render(&ground);
ge.Render(&target);
ge.Render(&target2);
ge.Render(&EndOfLine);
fpsC.tick();
Sleep(1000 / 120);
glfwSwapBuffers(window);
glfwPollEvents();// Processes all pending events
}
////////////////////////////////////////////////////////////
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}