Application.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. namespace AtomicEngine
  3. {
  4. public interface IAtomicSDLSurface
  5. {
  6. void Remove();
  7. bool IsAlive { get; }
  8. }
  9. public partial class Application : AObject
  10. {
  11. public static int Run<T>(string[] args) where T : AppDelegate, new()
  12. {
  13. return Run(typeof(T), args);
  14. }
  15. public static int Run(Type appDelegateType, string[] args)
  16. {
  17. // Create the Application
  18. AppBase app = null;
  19. #if ATOMIC_DESKTOP
  20. app = NETIPCPlayerApp.Create(args);
  21. #endif
  22. #if ATOMIC_ANDROID
  23. app = NETAtomicPlayer.Create(args);
  24. var renderer = AtomicNET.GetSubsystem<Renderer>();
  25. renderer.ReuseShadowMaps = false;
  26. renderer.ShadowQuality = ShadowQuality.SHADOWQUALITY_SIMPLE_16BIT;
  27. #endif
  28. appDelegate = (AppDelegate)Activator.CreateInstance(appDelegateType);
  29. appDelegate.Start();
  30. // Managed code in charge of main loop
  31. while (app.RunFrame())
  32. {
  33. appDelegate.PostFrame();
  34. }
  35. appDelegate.Shutdown();
  36. // Shut 'er down
  37. app.Shutdown();
  38. return 0;
  39. }
  40. internal static AppDelegate appDelegate;
  41. }
  42. }