Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    GameTime Class

    Namespace: Stride.Games
    Assembly: Stride.Games.dll

    Current timing used for variable-step (real time) or fixed-step (game time) games.

    System.Object → GameTime
    Derived from GameTime:

    public class GameTime
    Name Description
    Constructors
    GameTime()

    Initializes a new instance of the GameTime class.

    GameTime(TimeSpan, TimeSpan)

    Initializes a new instance of the GameTime class.

    Properties
    Elapsed

    Gets the elapsed game time since the last update

    Factor

    Gets or sets the time factor.
    This value controls how much the warped time flows, this includes physics, animations and particles. A value between 0 and 1 will slow time, a value above 1 will make it faster.

    FrameCount

    Gets the current frame count since the start of the game.

    FramePerSecond

    Gets the number of frame per second (FPS) for the current running game.

    FramePerSecondUpdated

    Gets a value indicating whether the FramePerSecond and TimePerFrame were updated for this frame.

    TimePerFrame

    Gets the time per frame.

    Total

    Gets the amount of game time since the start of the game.

    WarpElapsed

    Gets the amount of time elapsed multiplied by the time factor.

    Methods
    ResetTimeFactor()
    | Improve this Doc View Source

    Constructors


    GameTime()

    Initializes a new instance of the GameTime class.

    public GameTime()

    GameTime(TimeSpan, TimeSpan)

    Initializes a new instance of the GameTime class.

    public GameTime(TimeSpan totalTime, TimeSpan elapsedTime)
    Parameters
    Type Name Description
    System.TimeSpan totalTime

    The total game time since the start of the game.

    System.TimeSpan elapsedTime

    The elapsed game time since the last update.

    | Improve this Doc View Source

    Properties


    Elapsed

    Gets the elapsed game time since the last update

    public TimeSpan Elapsed { get; }
    Property Value
    Type Description
    System.TimeSpan

    The elapsed game time.


    Factor

    Gets or sets the time factor.
    This value controls how much the warped time flows, this includes physics, animations and particles. A value between 0 and 1 will slow time, a value above 1 will make it faster.

    public double Factor { get; set; }
    Property Value
    Type Description
    System.Double

    The multiply factor, a double value higher or equal to 0


    FrameCount

    Gets the current frame count since the start of the game.

    public int FrameCount { get; }
    Property Value
    Type Description
    System.Int32

    FramePerSecond

    Gets the number of frame per second (FPS) for the current running game.

    public float FramePerSecond { get; }
    Property Value
    Type Description
    System.Single

    The frame per second.


    FramePerSecondUpdated

    Gets a value indicating whether the FramePerSecond and TimePerFrame were updated for this frame.

    public bool FramePerSecondUpdated { get; }
    Property Value
    Type Description
    System.Boolean

    true if the FramePerSecond and TimePerFrame were updated for this frame; otherwise, false.


    TimePerFrame

    Gets the time per frame.

    public TimeSpan TimePerFrame { get; }
    Property Value
    Type Description
    System.TimeSpan

    The time per frame.


    Total

    Gets the amount of game time since the start of the game.

    public TimeSpan Total { get; }
    Property Value
    Type Description
    System.TimeSpan

    The total game time.


    WarpElapsed

    Gets the amount of time elapsed multiplied by the time factor.

    public TimeSpan WarpElapsed { get; }
    Property Value
    Type Description
    System.TimeSpan

    The warped elapsed time

    | Improve this Doc View Source

    Methods


    ResetTimeFactor()

    public void ResetTimeFactor()

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation