Engine.cs 15 KB

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