java_godot_io_wrapper.h 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*************************************************************************/
  2. /* java_godot_io_wrapper.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2020 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. // note, swapped java and godot around in the file name so all the java
  31. // wrappers are together
  32. #ifndef JAVA_GODOT_IO_WRAPPER_H
  33. #define JAVA_GODOT_IO_WRAPPER_H
  34. #include <android/log.h>
  35. #include <jni.h>
  36. #include "string_android.h"
  37. // Class that makes functions in java/src/org/godotengine/godot/GodotIO.java callable from C++
  38. class GodotIOJavaWrapper {
  39. private:
  40. jobject godot_io_instance;
  41. jclass cls;
  42. jmethodID _open_URI = 0;
  43. jmethodID _get_data_dir = 0;
  44. jmethodID _get_locale = 0;
  45. jmethodID _get_model = 0;
  46. jmethodID _get_screen_DPI = 0;
  47. jmethodID _get_unique_id = 0;
  48. jmethodID _show_keyboard = 0;
  49. jmethodID _hide_keyboard = 0;
  50. jmethodID _set_screen_orientation = 0;
  51. jmethodID _get_system_dir = 0;
  52. jmethodID _play_video = 0;
  53. jmethodID _is_video_playing = 0;
  54. jmethodID _pause_video = 0;
  55. jmethodID _stop_video = 0;
  56. public:
  57. GodotIOJavaWrapper(JNIEnv *p_env, jobject p_godot_io_instance);
  58. ~GodotIOJavaWrapper();
  59. jobject get_instance();
  60. Error open_uri(const String &p_uri);
  61. String get_user_data_dir();
  62. String get_locale();
  63. String get_model();
  64. int get_screen_dpi();
  65. String get_unique_id();
  66. bool has_vk();
  67. void show_vk(const String &p_existing, bool p_multiline, int p_max_input_length, int p_cursor_start, int p_cursor_end);
  68. void hide_vk();
  69. int get_vk_height();
  70. void set_vk_height(int p_height);
  71. void set_screen_orientation(int p_orient);
  72. String get_system_dir(int p_dir);
  73. void play_video(const String &p_path);
  74. bool is_video_playing();
  75. void pause_video();
  76. void stop_video();
  77. };
  78. #endif /* !JAVA_GODOT_IO_WRAPPER_H */