//********************************** Banshee Engine (www.banshee3d.com) **************************************************// //**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************// using System; using System.Runtime.CompilerServices; namespace BansheeEngine { /** @addtogroup Utility * @{ */ /// /// Manages all time related functionality. /// public static class Time { /// /// Gets the time elapsed since application start, in seconds. Only gets updated once per frame and keeps ticking /// even if the game is not running. /// public static float RealElapsed { get { return Internal_GetRealElapsed(); } } /// /// Gets the time elapsed since game start, in seconds. This value gets reset any time the game is started, and /// will not be updated while the game is paused. /// 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_GetRealElapsed(); [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(); } /** @} */ }