dedicatedWindowStub.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifdef TORQUE_DEDICATED
  23. #ifndef _DEDICATED_WINDOW_STUB_H_
  24. #define _DEDICATED_WINDOW_STUB_H_
  25. #include "windowManager/platformWindowMgr.h"
  26. /// The DedicatedWindowMgr is for Dedicated servers, which may not
  27. /// even have graphics hardware. However, the WindowManager is referenced
  28. /// (indirectly) by scripts, and therefore must exist.
  29. class DedicatedWindowMgr : public PlatformWindowManager
  30. {
  31. public:
  32. DedicatedWindowMgr() {};
  33. virtual ~DedicatedWindowMgr()
  34. {
  35. }
  36. static void processCmdLineArgs(const S32 argc, const char **argv) {}
  37. /// Return the extents in window coordinates of the primary desktop
  38. /// area. On dedicated systems, this returns a token value of 0.
  39. virtual RectI getPrimaryDesktopArea() { return RectI(0, 0, 0, 0); }
  40. /// Retrieve the currently set desktop bit depth.
  41. /// @return -1 since there is no desktop
  42. virtual S32 getDesktopBitDepth() { return -1; }
  43. /// Retrieve the currently set desktop resolution
  44. /// @return Point2I(-1,-1) since there is no desktop
  45. virtual Point2I getDesktopResolution() { return Point2I(-1, -1); }
  46. /// Populate a vector with the token primary desktop area value
  47. virtual void getMonitorRegions(Vector<RectI> &regions) { regions.push_back(getPrimaryDesktopArea()); }
  48. /// Create a new window, appropriate for the specified device and mode.
  49. ///
  50. /// @return NULL - there is no graphics hardware available in dedicated mode
  51. virtual PlatformWindow *createWindow(GFXDevice *device, const GFXVideoMode &mode) { return NULL; }
  52. /// Produces an empty list since there are no windows in dedicated mode
  53. virtual void getWindows(VectorPtr<PlatformWindow*> &windows) { windows.clear(); }
  54. /// Get the window that currently has the input focus or NULL.
  55. virtual PlatformWindow* getFocusedWindow() { return NULL; }
  56. /// Get a window from a device ID.
  57. ///
  58. /// @return NULL.
  59. virtual PlatformWindow *getWindowById(WindowId id) { return NULL; }
  60. /// Get the first window in the window list
  61. ///
  62. /// @return The first window in the list, or NULL if no windows found
  63. virtual PlatformWindow *getFirstWindow() { return NULL; }
  64. /// Set the parent window
  65. ///
  66. /// This does nothing in dedicated builds
  67. virtual void setParentWindow(void* newParent) {}
  68. /// Get the parent window - returns NULL for dedicated servers
  69. virtual void* getParentWindow() { return NULL; }
  70. /// This method cues the appearance of that window ("lowering the curtain").
  71. virtual void lowerCurtain() {}
  72. /// @see lowerCurtain
  73. ///
  74. /// This method removes the curtain window.
  75. virtual void raiseCurtain() {}
  76. private:
  77. /// Process command line arguments from StandardMainLoop. This is done to
  78. /// allow web plugin functionality, where we are passed platform-specific
  79. /// information allowing us to set ourselves up in the web browser,
  80. /// to occur in a platform-neutral way.
  81. virtual void _processCmdLineArgs(const S32 argc, const char **argv) {}
  82. };
  83. #endif // _DEDICATED_WINDOW_STUB_H_
  84. #endif // TORQUE_DEDICATED