📄 ball.cpp
字号:
#include "ball.h"
// Draw()
// desc: draws the ball at its current location
void CBall::Draw()
{
glPushMatrix();
glTranslatef(position.x, position.y, position.z);
glColor3f(0.5, 0.5, 0.5);
auxSolidSphere(radius);
glPopMatrix();
}
// Animate()
// desc: handles the physics calculations
void CBall::Animate(scalar_t deltaTime)
{
acceleration = CVector(0.0, -9.8, 0.0);
velocity = velocity + (acceleration * deltaTime);
position = position + (velocity * deltaTime);
}
//void CBall::Animate(scalar_t deltaTime,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -