Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/platform/android/java_godot_io_wrapper.h
10277 views
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) 2014-present Godot Engine contributors (see AUTHORS.md). */
9
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
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
31
#pragma once
32
33
#include "jni_utils.h"
34
35
#include "core/math/rect2i.h"
36
#include "core/variant/typed_array.h"
37
38
#include <android/log.h>
39
#include <jni.h>
40
41
// Class that makes functions in java/src/org/godotengine/godot/GodotIO.java callable from C++
42
class GodotIOJavaWrapper {
43
private:
44
jobject godot_io_instance;
45
jclass cls;
46
47
jmethodID _open_URI = 0;
48
jmethodID _get_cache_dir = 0;
49
jmethodID _get_data_dir = 0;
50
jmethodID _get_temp_dir = 0;
51
jmethodID _get_display_cutouts = 0;
52
jmethodID _get_display_rotation = 0;
53
jmethodID _get_display_safe_area = 0;
54
jmethodID _get_locale = 0;
55
jmethodID _get_model = 0;
56
jmethodID _get_screen_DPI = 0;
57
jmethodID _get_scaled_density = 0;
58
jmethodID _get_screen_refresh_rate = 0;
59
jmethodID _get_unique_id = 0;
60
jmethodID _show_keyboard = 0;
61
jmethodID _hide_keyboard = 0;
62
jmethodID _has_hardware_keyboard = 0;
63
jmethodID _set_screen_orientation = 0;
64
jmethodID _get_screen_orientation = 0;
65
jmethodID _get_system_dir = 0;
66
67
public:
68
GodotIOJavaWrapper(JNIEnv *p_env, jobject p_godot_io_instance);
69
~GodotIOJavaWrapper();
70
71
jobject get_instance();
72
73
Error open_uri(const String &p_uri);
74
String get_cache_dir();
75
String get_temp_dir();
76
String get_user_data_dir(const String &p_user_dir);
77
String get_locale();
78
String get_model();
79
int get_screen_dpi();
80
float get_scaled_density();
81
float get_screen_refresh_rate(float fallback);
82
TypedArray<Rect2> get_display_cutouts();
83
Rect2i get_display_safe_area();
84
String get_unique_id();
85
bool has_vk();
86
bool has_hardware_keyboard();
87
void show_vk(const String &p_existing, int p_type, int p_max_input_length, int p_cursor_start, int p_cursor_end);
88
void hide_vk();
89
int get_vk_height();
90
void set_vk_height(int p_height);
91
void set_screen_orientation(int p_orient);
92
int get_screen_orientation();
93
String get_system_dir(int p_dir, bool p_shared_storage);
94
int get_display_rotation();
95
};
96
97