문제
엔티티에 가속화를 추가 할 수있는 경과 된 Gametime 방법이 있는지 궁금해하고있었습니다.XNA의 경과 된 배우자 코드와 같은 것을 사용하고 싶습니다.각 프레임을 통과하는 시간 (초)은 가속 작업을 수행해야합니다.
해결책
GameWindow
를 사용하는 경우 FrameEventArgs
및 UpdateFrame
이벤트에서 RenderFrame
를 사용할 수 있습니다.
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);
}
}
. 제휴하지 않습니다 StackOverflow