Time.cs 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // Time.cs
  6. //
  7. // Copyright 2015 Xamarin Inc. All rights reserved.
  8. using System;
  9. using System.Runtime.InteropServices;
  10. using System.Collections.Generic;
  11. using Urho.Urho2D;
  12. using Urho.Gui;
  13. using Urho.Resources;
  14. using Urho.IO;
  15. using Urho.Navigation;
  16. using Urho.Network;
  17. namespace Urho
  18. {
  19. /// <summary>
  20. /// %Time and frame counter subsystem.
  21. /// </summary>
  22. public unsafe partial class Time : UrhoObject
  23. {
  24. unsafe partial void OnTimeCreated ();
  25. [Preserve]
  26. public Time (IntPtr handle) : base (handle)
  27. {
  28. OnTimeCreated ();
  29. }
  30. [Preserve]
  31. protected Time (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnTimeCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int Time_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (Time_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr Time_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (Time_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int Time_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(Time));
  54. return new StringHash (Time_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr Time_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(Time));
  61. return Marshal.PtrToStringAnsi (Time_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public Time () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr Time_Time (IntPtr context);
  69. [Preserve]
  70. public Time (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(Time));
  73. handle = Time_Time ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnTimeCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void Time_BeginFrame (IntPtr handle, float timeStep);
  79. /// <summary>
  80. /// Begin new frame, with (last) frame duration in seconds and send frame start event.
  81. /// </summary>
  82. public void BeginFrame (float timeStep)
  83. {
  84. Runtime.ValidateRefCounted (this);
  85. Time_BeginFrame (handle, timeStep);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern void Time_EndFrame (IntPtr handle);
  89. /// <summary>
  90. /// End frame. Increment total time and send frame end event.
  91. /// </summary>
  92. public void EndFrame ()
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. Time_EndFrame (handle);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern void Time_SetTimerPeriod (IntPtr handle, uint mSec);
  99. /// <summary>
  100. /// Set the low-resolution timer period in milliseconds. 0 resets to the default period.
  101. /// </summary>
  102. private void SetTimerPeriod (uint mSec)
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. Time_SetTimerPeriod (handle, mSec);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern uint Time_GetFrameNumber (IntPtr handle);
  109. /// <summary>
  110. /// Return frame number, starting from 1 once BeginFrame() is called for the first time.
  111. /// </summary>
  112. private uint GetFrameNumber ()
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. return Time_GetFrameNumber (handle);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern float Time_GetTimeStep (IntPtr handle);
  119. /// <summary>
  120. /// Return current frame timestep as seconds.
  121. /// </summary>
  122. private float GetTimeStep ()
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. return Time_GetTimeStep (handle);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern uint Time_GetTimerPeriod (IntPtr handle);
  129. /// <summary>
  130. /// Return current low-resolution timer period in milliseconds.
  131. /// </summary>
  132. private uint GetTimerPeriod ()
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. return Time_GetTimerPeriod (handle);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern float Time_GetElapsedTime (IntPtr handle);
  139. /// <summary>
  140. /// Return elapsed time from program start as seconds.
  141. /// </summary>
  142. private float GetElapsedTime ()
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. return Time_GetElapsedTime (handle);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern float Time_GetFramesPerSecond (IntPtr handle);
  149. /// <summary>
  150. /// Return current frames per second.
  151. /// </summary>
  152. private float GetFramesPerSecond ()
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. return Time_GetFramesPerSecond (handle);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern uint Time_GetSystemTime ();
  159. /// <summary>
  160. /// Get system time as milliseconds.
  161. /// </summary>
  162. private static uint GetSystemTime ()
  163. {
  164. Runtime.Validate (typeof(Time));
  165. return Time_GetSystemTime ();
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern uint Time_GetTimeSinceEpoch ();
  169. /// <summary>
  170. /// Get system time as seconds since 1.1.1970.
  171. /// </summary>
  172. private static uint GetTimeSinceEpoch ()
  173. {
  174. Runtime.Validate (typeof(Time));
  175. return Time_GetTimeSinceEpoch ();
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern IntPtr Time_GetTimeStamp ();
  179. /// <summary>
  180. /// Get a date/time stamp as a string.
  181. /// </summary>
  182. private static string GetTimeStamp ()
  183. {
  184. Runtime.Validate (typeof(Time));
  185. return Marshal.PtrToStringAnsi (Time_GetTimeStamp ());
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern void Time_Sleep (uint mSec);
  189. /// <summary>
  190. /// Sleep for a number of milliseconds.
  191. /// </summary>
  192. public static void Sleep (uint mSec)
  193. {
  194. Runtime.Validate (typeof(Time));
  195. Time_Sleep (mSec);
  196. }
  197. public override StringHash Type {
  198. get {
  199. return UrhoGetType ();
  200. }
  201. }
  202. public override string TypeName {
  203. get {
  204. return GetTypeName ();
  205. }
  206. }
  207. [Preserve]
  208. public static StringHash TypeStatic {
  209. get {
  210. return GetTypeStatic ();
  211. }
  212. }
  213. public static string TypeNameStatic {
  214. get {
  215. return GetTypeNameStatic ();
  216. }
  217. }
  218. /// <summary>
  219. /// Return current low-resolution timer period in milliseconds.
  220. /// Or
  221. /// Set the low-resolution timer period in milliseconds. 0 resets to the default period.
  222. /// </summary>
  223. public uint TimerPeriod {
  224. get {
  225. return GetTimerPeriod ();
  226. }
  227. set {
  228. SetTimerPeriod (value);
  229. }
  230. }
  231. /// <summary>
  232. /// Return frame number, starting from 1 once BeginFrame() is called for the first time.
  233. /// </summary>
  234. public uint FrameNumber {
  235. get {
  236. return GetFrameNumber ();
  237. }
  238. }
  239. /// <summary>
  240. /// Return current frame timestep as seconds.
  241. /// </summary>
  242. public float TimeStep {
  243. get {
  244. return GetTimeStep ();
  245. }
  246. }
  247. /// <summary>
  248. /// Return elapsed time from program start as seconds.
  249. /// </summary>
  250. public float ElapsedTime {
  251. get {
  252. return GetElapsedTime ();
  253. }
  254. }
  255. /// <summary>
  256. /// Return current frames per second.
  257. /// </summary>
  258. public float FramesPerSecond {
  259. get {
  260. return GetFramesPerSecond ();
  261. }
  262. }
  263. /// <summary>
  264. /// Get system time as milliseconds.
  265. /// </summary>
  266. public static uint SystemTime {
  267. get {
  268. return GetSystemTime ();
  269. }
  270. }
  271. /// <summary>
  272. /// Get system time as seconds since 1.1.1970.
  273. /// </summary>
  274. public static uint TimeSinceEpoch {
  275. get {
  276. return GetTimeSinceEpoch ();
  277. }
  278. }
  279. /// <summary>
  280. /// Get a date/time stamp as a string.
  281. /// </summary>
  282. public static string TimeStamp {
  283. get {
  284. return GetTimeStamp ();
  285. }
  286. }
  287. }
  288. }