using System; using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; using System.Text; namespace BansheeEngine { /// /// Manages all time related functionality. /// public static class Time { /// /// Gets the time elapsed since application start, in seconds. Only gets updated once per frame. /// public static float Elapsed { get { return Internal_GetElapsed(); } } /// /// Gets the time since last frame was executed, in seconds. Only gets updated once per frame. /// public static float FrameDelta { get { return Internal_GetFrameDelta(); } } /// /// Returns the sequential index of the current frame. First frame is 0. /// public static UInt64 FrameIdx { get { return Internal_GetFrameNumber(); } } /// /// Returns the precise time since application start, in microseconds. Unlike other time methods this is /// not only updated every frame, but will return exact time at the moment it is called. /// public static UInt64 Precise { get { return Internal_GetPrecise(); } } /// /// Multiply to convert microseconds to seconds. /// public const float MicroToSecond = 1.0f/1000000.0f; /// /// Multiply to convert seconds to microseconds. /// public const float SecondToMicro = 1000000.0f; [MethodImpl(MethodImplOptions.InternalCall)] private static extern float Internal_GetElapsed(); [MethodImpl(MethodImplOptions.InternalCall)] private static extern float Internal_GetFrameDelta(); [MethodImpl(MethodImplOptions.InternalCall)] private static extern UInt64 Internal_GetFrameNumber(); [MethodImpl(MethodImplOptions.InternalCall)] private static extern UInt64 Internal_GetPrecise(); } }