godot_js.h 4.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*************************************************************************/
  2. /* godot_js.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2021 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 GODOT_JS_H
  31. #define GODOT_JS_H
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #include "stddef.h"
  36. // Config
  37. extern void godot_js_config_locale_get(char *p_ptr, int p_ptr_max);
  38. extern void godot_js_config_canvas_id_get(char *p_ptr, int p_ptr_max);
  39. extern int godot_js_config_is_resize_on_start();
  40. // OS
  41. extern void godot_js_os_finish_async(void (*p_callback)());
  42. extern void godot_js_os_request_quit_cb(void (*p_callback)());
  43. extern int godot_js_os_fs_is_persistent();
  44. extern void godot_js_os_fs_sync(void (*p_callback)());
  45. extern int godot_js_os_execute(const char *p_json);
  46. extern void godot_js_os_shell_open(const char *p_uri);
  47. // Display
  48. extern double godot_js_display_pixel_ratio_get();
  49. extern void godot_js_display_alert(const char *p_text);
  50. extern int godot_js_display_touchscreen_is_available();
  51. extern int godot_js_display_is_swap_ok_cancel();
  52. // Display canvas
  53. extern void godot_js_display_canvas_focus();
  54. extern int godot_js_display_canvas_is_focused();
  55. extern void godot_js_display_canvas_bounding_rect_position_get(int32_t *p_x, int32_t *p_y);
  56. // Display window
  57. extern void godot_js_display_window_request_fullscreen();
  58. extern void godot_js_display_window_title_set(const char *p_text);
  59. extern void godot_js_display_window_icon_set(const uint8_t *p_ptr, int p_len);
  60. // Display clipboard
  61. extern int godot_js_display_clipboard_set(const char *p_text);
  62. extern int godot_js_display_clipboard_get(void (*p_callback)(const char *p_text));
  63. // Display cursor
  64. extern void godot_js_display_cursor_set_shape(const char *p_cursor);
  65. extern int godot_js_display_cursor_is_hidden();
  66. extern void godot_js_display_cursor_set_custom_shape(const char *p_shape, const uint8_t *p_ptr, int p_len, int p_hotspot_x, int p_hotspot_y);
  67. extern void godot_js_display_cursor_set_visible(int p_visible);
  68. // Display gamepad
  69. extern char *godot_js_display_gamepad_cb(void (*p_on_change)(int p_index, int p_connected, const char *p_id, const char *p_guid));
  70. extern int godot_js_display_gamepad_sample();
  71. extern int godot_js_display_gamepad_sample_count();
  72. extern int godot_js_display_gamepad_sample_get(int p_idx, float r_btns[16], int32_t *r_btns_num, float r_axes[10], int32_t *r_axes_num, int32_t *r_standard);
  73. // Display listeners
  74. extern void godot_js_display_notification_cb(void (*p_callback)(int p_notification), int p_enter, int p_exit, int p_in, int p_out);
  75. extern void godot_js_display_paste_cb(void (*p_callback)(const char *p_text));
  76. extern void godot_js_display_drop_files_cb(void (*p_callback)(char **p_filev, int p_filec));
  77. extern void godot_js_display_setup_canvas();
  78. #ifdef __cplusplus
  79. }
  80. #endif
  81. #endif /* GODOT_JS_H */