Advertisement
Guest User

Headless

a guest
Nov 9th, 2016
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. Index: MonoGame.Framework/Game.cs
  2. ===================================================================
  3. --- MonoGame.Framework/Game.cs (revision 23517)
  4. +++ MonoGame.Framework/Game.cs (working copy)
  5. @@ -176,6 +176,11 @@
  6. get { return _components; }
  7. }
  8.  
  9. + public void SetHeadless(bool value)
  10. + {
  11. + Platform.Headless = value;
  12. + }
  13. +
  14. public TimeSpan InactiveSleepTime
  15. {
  16. get { return _inactiveSleepTime; }
  17. @@ -677,6 +682,13 @@
  18. internal void DoInitialize()
  19. {
  20. AssertNotDisposed();
  21. +
  22. + if (Platform.Headless)
  23. + {
  24. + Initialize();
  25. + return;
  26. + }
  27. +
  28. Platform.BeforeInitialize();
  29. Initialize();
  30.  
  31. Index: MonoGame.Framework/GamePlatform.cs
  32. ===================================================================
  33. --- MonoGame.Framework/GamePlatform.cs (revision 23517)
  34. +++ MonoGame.Framework/GamePlatform.cs (working copy)
  35. @@ -54,6 +54,8 @@
  36. get; private set;
  37. }
  38.  
  39. + internal bool Headless = false;
  40. +
  41. private bool _isActive;
  42. public bool IsActive
  43. {
  44. Index: MonoGame.Framework/SDL/SDLGamePlatform.cs
  45. ===================================================================
  46. --- MonoGame.Framework/SDL/SDLGamePlatform.cs (revision 23517)
  47. +++ MonoGame.Framework/SDL/SDLGamePlatform.cs (working copy)
  48. @@ -99,7 +99,10 @@
  49.  
  50. public override void RunLoop()
  51. {
  52. - Sdl.Window.Show(Window.Handle);
  53. + if (!Headless)
  54. + {
  55. + Sdl.Window.Show(Window.Handle);
  56. + }
  57.  
  58. while (true)
  59. {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement