質問

私は経過したGameTimeメソッドがあるかどうか疑問に思います。Xnaの経過gametimeコードのようなものを使いたいです。各フレームを通過する秒数は、アクセラレーション作業を受ける必要があるすべてです。

役に立ちましたか?

解決

GameWindowを使用している場合は、FrameEventArgsUpdateFrameイベントから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);
    }
}
.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top