我想知道是否有任何经过的游戏时间方法,我可以添加加速到一个实体。我想使用类似XNA经过的游戏时间代码。通过每一帧的秒数是我所需要的所有加速工作。
发布于 2014-04-11 23:12:31
如果使用的是GameWindow,则可以使用来自UpdateFrame和RenderFrame事件的FrameEventArgs。
class MyGame : GameWindow
{
double seconds;
Vector3 position;
protected override void OnUpdateFrame(object sender, FrameEventArgs e)
{
// e.Time is the elapsed time from the previous UpdateFrame event
// in seconds
seconds += e.Time;
position = new Vector3(
(float)Math.Cos(seconds),
(float)Math.Sin(seconds),
1.0f);
}
}https://stackoverflow.com/questions/23001218
复制相似问题