Engine.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // Engine.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. /// Urho3D engine. Creates the other subsystems.
  21. /// </summary>
  22. public unsafe partial class Engine : UrhoObject
  23. {
  24. unsafe partial void OnEngineCreated ();
  25. [Preserve]
  26. public Engine (IntPtr handle) : base (handle)
  27. {
  28. OnEngineCreated ();
  29. }
  30. [Preserve]
  31. protected Engine (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnEngineCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int Engine_GetType (IntPtr handle);
  37. private StringHash GetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (Engine_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr Engine_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (Engine_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int Engine_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(Engine));
  54. return new StringHash (Engine_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr Engine_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(Engine));
  61. return Marshal.PtrToStringAnsi (Engine_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public Engine () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr Engine_Engine (IntPtr context);
  69. [Preserve]
  70. public Engine (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(Engine));
  73. handle = Engine_Engine ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnEngineCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern int Engine_RunFrame (IntPtr handle);
  79. /// <summary>
  80. /// Run one frame.
  81. /// </summary>
  82. public int RunFrame ()
  83. {
  84. Runtime.ValidateRefCounted (this);
  85. return Engine_RunFrame (handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern IntPtr Engine_CreateConsole (IntPtr handle);
  89. /// <summary>
  90. /// Create the console and return it. May return null if engine configuration does not allow creation (headless mode.)
  91. /// </summary>
  92. public Urho.UrhoConsole CreateConsole ()
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. return Runtime.LookupObject<Urho.UrhoConsole> (Engine_CreateConsole (handle));
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern IntPtr Engine_CreateDebugHud (IntPtr handle);
  99. /// <summary>
  100. /// Create the debug hud.
  101. /// </summary>
  102. public DebugHud CreateDebugHud ()
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. return Runtime.LookupObject<DebugHud> (Engine_CreateDebugHud (handle));
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern void Engine_SetMinFps (IntPtr handle, int fps);
  109. /// <summary>
  110. /// Set minimum frames per second. If FPS goes lower than this, time will appear to slow down.
  111. /// </summary>
  112. private void SetMinFps (int fps)
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. Engine_SetMinFps (handle, fps);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern void Engine_SetMaxFps (IntPtr handle, int fps);
  119. /// <summary>
  120. /// Set maximum frames per second. The engine will sleep if FPS is higher than this.
  121. /// </summary>
  122. private void SetMaxFps (int fps)
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. Engine_SetMaxFps (handle, fps);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern void Engine_SetMaxInactiveFps (IntPtr handle, int fps);
  129. /// <summary>
  130. /// Set maximum frames per second when the application does not have input focus.
  131. /// </summary>
  132. private void SetMaxInactiveFps (int fps)
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. Engine_SetMaxInactiveFps (handle, fps);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern void Engine_SetTimeStepSmoothing (IntPtr handle, int frames);
  139. /// <summary>
  140. /// Set how many frames to average for timestep smoothing. Default is 2. 1 disables smoothing.
  141. /// </summary>
  142. private void SetTimeStepSmoothing (int frames)
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. Engine_SetTimeStepSmoothing (handle, frames);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern void Engine_SetPauseMinimized (IntPtr handle, bool enable);
  149. /// <summary>
  150. /// Set whether to pause update events and audio when minimized.
  151. /// </summary>
  152. private void SetPauseMinimized (bool enable)
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. Engine_SetPauseMinimized (handle, enable);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern void Engine_SetAutoExit (IntPtr handle, bool enable);
  159. /// <summary>
  160. /// Set whether to exit automatically on exit request (window close button.)
  161. /// </summary>
  162. private void SetAutoExit (bool enable)
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. Engine_SetAutoExit (handle, enable);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern void Engine_SetNextTimeStep (IntPtr handle, float seconds);
  169. /// <summary>
  170. /// Override timestep of the next frame. Should be called in between RunFrame() calls.
  171. /// </summary>
  172. private void SetNextTimeStep (float seconds)
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. Engine_SetNextTimeStep (handle, seconds);
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern void Engine_Exit (IntPtr handle);
  179. /// <summary>
  180. /// Close the graphics window and set the exit flag. No-op on iOS/tvOS, as an iOS/tvOS application can not legally exit.
  181. /// </summary>
  182. internal void Exit ()
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. Engine_Exit (handle);
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern void Engine_DumpProfiler (IntPtr handle);
  189. /// <summary>
  190. /// Dump profiling information to the log.
  191. /// </summary>
  192. public void DumpProfiler ()
  193. {
  194. Runtime.ValidateRefCounted (this);
  195. Engine_DumpProfiler (handle);
  196. }
  197. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  198. internal static extern void Engine_DumpResources (IntPtr handle, bool dumpFileName);
  199. /// <summary>
  200. /// Dump information of all resources to the log.
  201. /// </summary>
  202. public void DumpResources (bool dumpFileName = false)
  203. {
  204. Runtime.ValidateRefCounted (this);
  205. Engine_DumpResources (handle, dumpFileName);
  206. }
  207. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  208. internal static extern void Engine_DumpMemory (IntPtr handle);
  209. /// <summary>
  210. /// Dump information of all memory allocations to the log. Supported in MSVC debug mode only.
  211. /// </summary>
  212. public void DumpMemory ()
  213. {
  214. Runtime.ValidateRefCounted (this);
  215. Engine_DumpMemory (handle);
  216. }
  217. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  218. internal static extern float Engine_GetNextTimeStep (IntPtr handle);
  219. /// <summary>
  220. /// Get timestep of the next frame. Updated by ApplyFrameLimit().
  221. /// </summary>
  222. private float GetNextTimeStep ()
  223. {
  224. Runtime.ValidateRefCounted (this);
  225. return Engine_GetNextTimeStep (handle);
  226. }
  227. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  228. internal static extern int Engine_GetMinFps (IntPtr handle);
  229. /// <summary>
  230. /// Return the minimum frames per second.
  231. /// </summary>
  232. private int GetMinFps ()
  233. {
  234. Runtime.ValidateRefCounted (this);
  235. return Engine_GetMinFps (handle);
  236. }
  237. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  238. internal static extern int Engine_GetMaxFps (IntPtr handle);
  239. /// <summary>
  240. /// Return the maximum frames per second.
  241. /// </summary>
  242. private int GetMaxFps ()
  243. {
  244. Runtime.ValidateRefCounted (this);
  245. return Engine_GetMaxFps (handle);
  246. }
  247. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  248. internal static extern int Engine_GetMaxInactiveFps (IntPtr handle);
  249. /// <summary>
  250. /// Return the maximum frames per second when the application does not have input focus.
  251. /// </summary>
  252. private int GetMaxInactiveFps ()
  253. {
  254. Runtime.ValidateRefCounted (this);
  255. return Engine_GetMaxInactiveFps (handle);
  256. }
  257. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  258. internal static extern int Engine_GetTimeStepSmoothing (IntPtr handle);
  259. /// <summary>
  260. /// Return how many frames to average for timestep smoothing.
  261. /// </summary>
  262. private int GetTimeStepSmoothing ()
  263. {
  264. Runtime.ValidateRefCounted (this);
  265. return Engine_GetTimeStepSmoothing (handle);
  266. }
  267. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  268. internal static extern bool Engine_GetPauseMinimized (IntPtr handle);
  269. /// <summary>
  270. /// Return whether to pause update events and audio when minimized.
  271. /// </summary>
  272. private bool GetPauseMinimized ()
  273. {
  274. Runtime.ValidateRefCounted (this);
  275. return Engine_GetPauseMinimized (handle);
  276. }
  277. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  278. internal static extern bool Engine_GetAutoExit (IntPtr handle);
  279. /// <summary>
  280. /// Return whether to exit automatically on exit request.
  281. /// </summary>
  282. private bool GetAutoExit ()
  283. {
  284. Runtime.ValidateRefCounted (this);
  285. return Engine_GetAutoExit (handle);
  286. }
  287. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  288. internal static extern bool Engine_IsInitialized (IntPtr handle);
  289. /// <summary>
  290. /// Return whether engine has been initialized.
  291. /// </summary>
  292. private bool IsInitialized ()
  293. {
  294. Runtime.ValidateRefCounted (this);
  295. return Engine_IsInitialized (handle);
  296. }
  297. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  298. internal static extern bool Engine_IsExiting (IntPtr handle);
  299. /// <summary>
  300. /// Return whether exit has been requested.
  301. /// </summary>
  302. private bool IsExiting ()
  303. {
  304. Runtime.ValidateRefCounted (this);
  305. return Engine_IsExiting (handle);
  306. }
  307. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  308. internal static extern bool Engine_IsHeadless (IntPtr handle);
  309. /// <summary>
  310. /// Return whether the engine has been created in headless mode.
  311. /// </summary>
  312. private bool IsHeadless ()
  313. {
  314. Runtime.ValidateRefCounted (this);
  315. return Engine_IsHeadless (handle);
  316. }
  317. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  318. internal static extern void Engine_Update (IntPtr handle);
  319. /// <summary>
  320. /// Send frame update events.
  321. /// </summary>
  322. public void UpdateFrame ()
  323. {
  324. Runtime.ValidateRefCounted (this);
  325. Engine_Update (handle);
  326. }
  327. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  328. internal static extern void Engine_Render (IntPtr handle);
  329. /// <summary>
  330. /// Render after frame update.
  331. /// </summary>
  332. public void Render ()
  333. {
  334. Runtime.ValidateRefCounted (this);
  335. Engine_Render (handle);
  336. }
  337. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  338. internal static extern int Engine_ApplyFrameLimit (IntPtr handle);
  339. /// <summary>
  340. /// Get the timestep for the next frame and sleep for frame limiting if necessary.
  341. /// </summary>
  342. public int ApplyFrameLimit ()
  343. {
  344. Runtime.ValidateRefCounted (this);
  345. return Engine_ApplyFrameLimit (handle);
  346. }
  347. public override StringHash Type {
  348. get {
  349. return GetType ();
  350. }
  351. }
  352. public override string TypeName {
  353. get {
  354. return GetTypeName ();
  355. }
  356. }
  357. [Preserve]
  358. public static StringHash TypeStatic {
  359. get {
  360. return GetTypeStatic ();
  361. }
  362. }
  363. public static string TypeNameStatic {
  364. get {
  365. return GetTypeNameStatic ();
  366. }
  367. }
  368. /// <summary>
  369. /// Return the minimum frames per second.
  370. /// Or
  371. /// Set minimum frames per second. If FPS goes lower than this, time will appear to slow down.
  372. /// </summary>
  373. public int MinFps {
  374. get {
  375. return GetMinFps ();
  376. }
  377. set {
  378. SetMinFps (value);
  379. }
  380. }
  381. /// <summary>
  382. /// Return the maximum frames per second.
  383. /// Or
  384. /// Set maximum frames per second. The engine will sleep if FPS is higher than this.
  385. /// </summary>
  386. public int MaxFps {
  387. get {
  388. return GetMaxFps ();
  389. }
  390. set {
  391. SetMaxFps (value);
  392. }
  393. }
  394. /// <summary>
  395. /// Return the maximum frames per second when the application does not have input focus.
  396. /// Or
  397. /// Set maximum frames per second when the application does not have input focus.
  398. /// </summary>
  399. public int MaxInactiveFps {
  400. get {
  401. return GetMaxInactiveFps ();
  402. }
  403. set {
  404. SetMaxInactiveFps (value);
  405. }
  406. }
  407. /// <summary>
  408. /// Return how many frames to average for timestep smoothing.
  409. /// Or
  410. /// Set how many frames to average for timestep smoothing. Default is 2. 1 disables smoothing.
  411. /// </summary>
  412. public int TimeStepSmoothing {
  413. get {
  414. return GetTimeStepSmoothing ();
  415. }
  416. set {
  417. SetTimeStepSmoothing (value);
  418. }
  419. }
  420. /// <summary>
  421. /// Return whether to pause update events and audio when minimized.
  422. /// Or
  423. /// Set whether to pause update events and audio when minimized.
  424. /// </summary>
  425. public bool PauseMinimized {
  426. get {
  427. return GetPauseMinimized ();
  428. }
  429. set {
  430. SetPauseMinimized (value);
  431. }
  432. }
  433. /// <summary>
  434. /// Return whether to exit automatically on exit request.
  435. /// Or
  436. /// Set whether to exit automatically on exit request (window close button.)
  437. /// </summary>
  438. public bool AutoExit {
  439. get {
  440. return GetAutoExit ();
  441. }
  442. set {
  443. SetAutoExit (value);
  444. }
  445. }
  446. /// <summary>
  447. /// Get timestep of the next frame. Updated by ApplyFrameLimit().
  448. /// Or
  449. /// Override timestep of the next frame. Should be called in between RunFrame() calls.
  450. /// </summary>
  451. public float NextTimeStep {
  452. get {
  453. return GetNextTimeStep ();
  454. }
  455. set {
  456. SetNextTimeStep (value);
  457. }
  458. }
  459. /// <summary>
  460. /// Return whether engine has been initialized.
  461. /// </summary>
  462. public bool Initialized {
  463. get {
  464. return IsInitialized ();
  465. }
  466. }
  467. /// <summary>
  468. /// Return whether exit has been requested.
  469. /// </summary>
  470. public bool Exiting {
  471. get {
  472. return IsExiting ();
  473. }
  474. }
  475. /// <summary>
  476. /// Return whether the engine has been created in headless mode.
  477. /// </summary>
  478. public bool Headless {
  479. get {
  480. return IsHeadless ();
  481. }
  482. }
  483. }
  484. }