os_haiku.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*************************************************************************/
  2. /* os_haiku.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_HAIKU_H
  31. #define OS_HAIKU_H
  32. #include "audio_driver_media_kit.h"
  33. #include "context_gl_haiku.h"
  34. #include "drivers/unix/os_unix.h"
  35. #include "haiku_application.h"
  36. #include "haiku_direct_window.h"
  37. #include "main/input_default.h"
  38. #include "servers/audio_server.h"
  39. #include "servers/visual_server.h"
  40. class OS_Haiku : public OS_Unix {
  41. private:
  42. HaikuApplication *app;
  43. HaikuDirectWindow *window;
  44. MainLoop *main_loop;
  45. InputDefault *input;
  46. VisualServer *visual_server;
  47. VideoMode current_video_mode;
  48. int video_driver_index;
  49. #ifdef MEDIA_KIT_ENABLED
  50. AudioDriverMediaKit driver_media_kit;
  51. #endif
  52. #if defined(OPENGL_ENABLED)
  53. ContextGL_Haiku *context_gl;
  54. #endif
  55. virtual void delete_main_loop();
  56. protected:
  57. virtual int get_video_driver_count() const;
  58. virtual const char *get_video_driver_name(int p_driver) const;
  59. virtual int get_current_video_driver() const;
  60. virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
  61. virtual void finalize();
  62. virtual void set_main_loop(MainLoop *p_main_loop);
  63. public:
  64. OS_Haiku();
  65. void run();
  66. virtual String get_name();
  67. virtual MainLoop *get_main_loop() const;
  68. virtual bool can_draw() const;
  69. virtual void release_rendering_thread();
  70. virtual void make_rendering_thread();
  71. virtual void swap_buffers();
  72. virtual Point2 get_mouse_position() const;
  73. virtual int get_mouse_button_state() const;
  74. virtual void set_cursor_shape(CursorShape p_shape);
  75. virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot);
  76. virtual int get_screen_count() const;
  77. virtual int get_current_screen() const;
  78. virtual void set_current_screen(int p_screen);
  79. virtual Point2 get_screen_position(int p_screen = -1) const;
  80. virtual Size2 get_screen_size(int p_screen = -1) const;
  81. virtual void set_window_title(const String &p_title);
  82. virtual Size2 get_window_size() const;
  83. virtual void set_window_size(const Size2 p_size);
  84. virtual Point2 get_window_position() const;
  85. virtual void set_window_position(const Point2 &p_position);
  86. virtual void set_window_fullscreen(bool p_enabled);
  87. virtual bool is_window_fullscreen() const;
  88. virtual void set_window_resizable(bool p_enabled);
  89. virtual bool is_window_resizable() const;
  90. virtual void set_window_minimized(bool p_enabled);
  91. virtual bool is_window_minimized() const;
  92. virtual void set_window_maximized(bool p_enabled);
  93. virtual bool is_window_maximized() const;
  94. virtual void set_video_mode(const VideoMode &p_video_mode, int p_screen = 0);
  95. virtual VideoMode get_video_mode(int p_screen = 0) const;
  96. virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const;
  97. virtual String get_executable_path() const;
  98. virtual OS::PowerState get_power_state();
  99. virtual int get_power_seconds_left();
  100. virtual int get_power_percent_left();
  101. virtual bool _check_internal_feature_support(const String &p_feature);
  102. virtual String get_config_path() const;
  103. virtual String get_data_path() const;
  104. virtual String get_cache_path() const;
  105. };
  106. #endif