os_server.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*************************************************************************/
  2. /* os_server.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef OS_SERVER_H
  31. #define OS_SERVER_H
  32. #include "drivers/rtaudio/audio_driver_rtaudio.h"
  33. #include "drivers/unix/os_unix.h"
  34. #include "main/input_default.h"
  35. #include "servers/audio/audio_driver_dummy.h"
  36. #include "servers/audio/audio_server_sw.h"
  37. #include "servers/audio/sample_manager_sw.h"
  38. #include "servers/physics_2d/physics_2d_server_sw.h"
  39. #include "servers/physics_server.h"
  40. #include "servers/spatial_sound/spatial_sound_server_sw.h"
  41. #include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
  42. #include "servers/visual/rasterizer.h"
  43. #include "servers/visual_server.h"
  44. //bitch
  45. #undef CursorShape
  46. /**
  47. @author Juan Linietsky <[email protected]>
  48. */
  49. class OS_Server : public OS_Unix {
  50. Rasterizer *rasterizer;
  51. VisualServer *visual_server;
  52. VideoMode current_videomode;
  53. List<String> args;
  54. MainLoop *main_loop;
  55. AudioDriverDummy driver_dummy;
  56. bool grab;
  57. PhysicsServer *physics_server;
  58. Physics2DServer *physics_2d_server;
  59. virtual void delete_main_loop();
  60. IP_Unix *ip_unix;
  61. AudioServerSW *audio_server;
  62. SampleManagerMallocSW *sample_manager;
  63. SpatialSoundServerSW *spatial_sound_server;
  64. SpatialSound2DServerSW *spatial_sound_2d_server;
  65. bool force_quit;
  66. InputDefault *input;
  67. protected:
  68. virtual int get_video_driver_count() const;
  69. virtual const char *get_video_driver_name(int p_driver) const;
  70. virtual VideoMode get_default_video_mode() const;
  71. virtual void initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
  72. virtual void finalize();
  73. virtual void set_main_loop(MainLoop *p_main_loop);
  74. public:
  75. virtual String get_name();
  76. virtual void set_cursor_shape(CursorShape p_shape);
  77. virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot);
  78. virtual void set_mouse_show(bool p_show);
  79. virtual void set_mouse_grab(bool p_grab);
  80. virtual bool is_mouse_grab_enabled() const;
  81. virtual Point2 get_mouse_pos() const;
  82. virtual int get_mouse_button_state() const;
  83. virtual void set_window_title(const String &p_title);
  84. virtual MainLoop *get_main_loop() const;
  85. virtual bool can_draw() const;
  86. virtual void set_video_mode(const VideoMode &p_video_mode, int p_screen = 0);
  87. virtual VideoMode get_video_mode(int p_screen = 0) const;
  88. virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const;
  89. virtual Size2 get_window_size() const;
  90. virtual void move_window_to_foreground();
  91. void run();
  92. OS_Server();
  93. };
  94. #endif