本文整理汇总了C++中Frame::GetOriginY方法的典型用法代码示例。如果您正苦于以下问题:C++ Frame::GetOriginY方法的具体用法?C++ Frame::GetOriginY怎么用?C++ Frame::GetOriginY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Frame
的用法示例。
在下文中一共展示了Frame::GetOriginY方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void App::Update(const delta_t dt, const delta_t elapsed)
{
// retrieve current mouse state
mouse_info mi = GetMouse();
string buffer;
// write program information to window title
if (blurEnabled) buffer = "[B]";
SetWindowTitle("firefly-demo v%d.%d (FPS: %.2lf)"
" x-%d y-%d %s",
FF_MAJOR_VERSION, FF_MINOR_VERSION,
GetFPS(), mi.x, mi.y, buffer.c_str());
// calculate movement rate and direction
bool forceBlur = false;
if (GetKey('A')) {
cameraFrame.MoveRight(MOVE_SPEED*dt);
forceBlur = true;
}
if (GetKey('D')) {
cameraFrame.MoveRight(-MOVE_SPEED*dt);
forceBlur = true;
}
if (GetKey('W')) {
cameraFrame.MoveForward(MOVE_SPEED*dt);
forceBlur = true;
}
if (GetKey('S')) {
cameraFrame.MoveForward(-MOVE_SPEED*dt);
forceBlur = true;
}
// calculate mouse delta
float delta = (GetWidth() / 2.f) - mi.x;
moveBlur = (abs(delta) > BLUR_MIN_DELTA || forceBlur) ? true : false;
cameraFrame.RotateWorld( -delta * TURN_SPEED * dt / 4, 0, 1, 0);
// keep the mouse centered
glfwSetMousePos(GetWidth() / 2, GetHeight() / 2);
// handle current jumping state
if (jumping) {
jumpVel -= JUMP_GRAVITY * dt;
cameraFrame.MoveUp(jumpVel * dt);
// if we have landed
if (cameraFrame.GetOriginY() < 0) {
jumping = false;
jumpVel = 0;
// make sure we are positioned back at ground height
float dist = cameraFrame.GetOriginY();
cameraFrame.MoveUp(cameraFrame.GetOriginY() - dist);
}
}
}