os_unix.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*************************************************************************/
  2. /* os_unix.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* http://www.godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
  9. /* */
  10. /* Permission is hereby granted, free of charge, to any person obtaining */
  11. /* a copy of this software and associated documentation files (the */
  12. /* "Software"), to deal in the Software without restriction, including */
  13. /* without limitation the rights to use, copy, modify, merge, publish, */
  14. /* distribute, sublicense, and/or sell copies of the Software, and to */
  15. /* permit persons to whom the Software is furnished to do so, subject to */
  16. /* the following conditions: */
  17. /* */
  18. /* The above copyright notice and this permission notice shall be */
  19. /* included in all copies or substantial portions of the Software. */
  20. /* */
  21. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  22. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  23. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  24. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  25. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  26. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  27. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  28. /*************************************************************************/
  29. #ifndef OS_UNIX_H
  30. #define OS_UNIX_H
  31. /**
  32. @author Juan Linietsky <reduzio@gmail.com>
  33. */
  34. #ifdef UNIX_ENABLED
  35. #include "os/os.h"
  36. #include "drivers/unix/ip_unix.h"
  37. class OS_Unix : public OS {
  38. uint64_t ticks_start;
  39. protected:
  40. // UNIX only handles the core functions.
  41. // inheriting platforms under unix (eg. X11) should handle the rest
  42. //virtual int get_video_driver_count() const;
  43. //virtual const char * get_video_driver_name(int p_driver) const;
  44. //virtual VideoMode get_default_video_mode() const;
  45. virtual int get_audio_driver_count() const;
  46. virtual const char * get_audio_driver_name(int p_driver) const;
  47. virtual void initialize_core();
  48. virtual int unix_initialize_audio(int p_audio_driver);
  49. //virtual void initialize(int p_video_driver,int p_audio_driver);
  50. //virtual void finalize();
  51. virtual void finalize_core();
  52. String stdin_buf;
  53. public:
  54. virtual void print_error(const char* p_function,const char* p_file,int p_line,const char *p_code,const char*p_rationale,ErrorType p_type=ERR_ERROR);
  55. virtual void print(const char *p_format, ... );
  56. virtual void vprint(const char* p_format, va_list p_list,bool p_stderr=false);
  57. virtual void alert(const String& p_alert,const String& p_title="ALERT!");
  58. virtual String get_stdin_string(bool p_block);
  59. //virtual void set_mouse_show(bool p_show);
  60. //virtual void set_mouse_grab(bool p_grab);
  61. //virtual bool is_mouse_grab_enabled() const = 0;
  62. //virtual void get_mouse_pos(int &x, int &y) const;
  63. //virtual void set_window_title(const String& p_title);
  64. //virtual void set_video_mode(const VideoMode& p_video_mode);
  65. //virtual VideoMode get_video_mode() const;
  66. //virtual void get_fullscreen_mode_list(List<VideoMode> *p_list) const;
  67. virtual Error set_cwd(const String& p_cwd);
  68. virtual String get_name();
  69. virtual Date get_date() const;
  70. virtual Time get_time() const;
  71. virtual uint64_t get_unix_time() const;
  72. virtual void delay_usec(uint32_t p_usec) const;
  73. virtual uint64_t get_ticks_usec() const;
  74. virtual Error execute(const String& p_path, const List<String>& p_arguments,bool p_blocking,ProcessID *r_child_id=NULL,String* r_pipe=NULL,int *r_exitcode=NULL);
  75. virtual Error kill(const ProcessID& p_pid);
  76. virtual int get_process_ID() const;
  77. virtual bool has_environment(const String& p_var) const;
  78. virtual String get_environment(const String& p_var) const;
  79. virtual String get_locale() const;
  80. virtual int get_processor_count() const;
  81. virtual void debug_break();
  82. virtual String get_executable_path() const;
  83. virtual String get_data_dir() const;
  84. //virtual void run( MainLoop * p_main_loop );
  85. };
  86. #endif
  87. #endif