2022-03-23 20:46:05 +01:00
|
|
|
#ifndef JAVA_PANDEMONIUM_IO_WRAPPER_H
|
|
|
|
#define JAVA_PANDEMONIUM_IO_WRAPPER_H
|
2022-03-15 13:29:32 +01:00
|
|
|
/*************************************************************************/
|
2022-03-23 20:46:05 +01:00
|
|
|
/* java_pandemonium_io_wrapper.h */
|
2022-03-15 13:29:32 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
2022-03-23 20:46:05 +01:00
|
|
|
/* PANDEMONIUM ENGINE */
|
2022-03-15 13:29:32 +01:00
|
|
|
/* https://godotengine.org */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2022-03-23 20:46:05 +01:00
|
|
|
// note, swapped java and pandemonium around in the file name so all the java
|
2022-03-15 13:29:32 +01:00
|
|
|
// wrappers are together
|
|
|
|
|
|
|
|
#include <android/log.h>
|
|
|
|
#include <jni.h>
|
|
|
|
|
|
|
|
#include "string_android.h"
|
|
|
|
|
2023-08-31 21:59:44 +02:00
|
|
|
// Class that makes functions in java/src/org/pandemoniumengine/pandemonium/PandemoniumIO.java callable from C++
|
2022-03-23 20:46:05 +01:00
|
|
|
class PandemoniumIOJavaWrapper {
|
2022-03-15 13:29:32 +01:00
|
|
|
private:
|
2022-03-23 20:46:05 +01:00
|
|
|
jobject pandemonium_io_instance;
|
2022-03-15 13:29:32 +01:00
|
|
|
jclass cls;
|
|
|
|
|
|
|
|
jmethodID _open_URI = 0;
|
|
|
|
jmethodID _get_cache_dir = 0;
|
|
|
|
jmethodID _get_data_dir = 0;
|
2022-07-27 00:21:20 +02:00
|
|
|
jmethodID _get_display_cutouts = 0;
|
2022-03-15 13:29:32 +01:00
|
|
|
jmethodID _get_locale = 0;
|
|
|
|
jmethodID _get_model = 0;
|
|
|
|
jmethodID _get_screen_DPI = 0;
|
2022-07-25 22:07:34 +02:00
|
|
|
jmethodID _get_scaled_density = 0;
|
2022-03-15 13:29:32 +01:00
|
|
|
jmethodID _get_screen_refresh_rate = 0;
|
|
|
|
jmethodID _get_window_safe_area = 0;
|
|
|
|
jmethodID _get_unique_id = 0;
|
|
|
|
jmethodID _show_keyboard = 0;
|
|
|
|
jmethodID _hide_keyboard = 0;
|
|
|
|
jmethodID _set_screen_orientation = 0;
|
|
|
|
jmethodID _get_screen_orientation = 0;
|
|
|
|
jmethodID _get_system_dir = 0;
|
|
|
|
|
|
|
|
public:
|
2022-03-23 20:46:05 +01:00
|
|
|
PandemoniumIOJavaWrapper(JNIEnv *p_env, jobject p_pandemonium_io_instance);
|
|
|
|
~PandemoniumIOJavaWrapper();
|
2022-03-15 13:29:32 +01:00
|
|
|
|
|
|
|
jobject get_instance();
|
|
|
|
|
|
|
|
Error open_uri(const String &p_uri);
|
|
|
|
String get_cache_dir();
|
|
|
|
String get_user_data_dir();
|
|
|
|
String get_locale();
|
|
|
|
String get_model();
|
|
|
|
int get_screen_dpi();
|
2022-07-25 22:07:34 +02:00
|
|
|
float get_scaled_density();
|
2022-03-15 13:29:32 +01:00
|
|
|
void get_window_safe_area(int (&p_rect_xywh)[4]);
|
2022-07-27 00:21:20 +02:00
|
|
|
Array get_display_cutouts();
|
2022-03-15 13:29:32 +01:00
|
|
|
float get_screen_refresh_rate(float p_fallback);
|
|
|
|
String get_unique_id();
|
|
|
|
bool has_vk();
|
2022-08-19 16:18:53 +02:00
|
|
|
void show_vk(const String &p_existing, int p_type, int p_max_input_length, int p_cursor_start, int p_cursor_end);
|
2022-03-15 13:29:32 +01:00
|
|
|
void hide_vk();
|
|
|
|
int get_vk_height();
|
|
|
|
void set_vk_height(int p_height);
|
|
|
|
void set_screen_orientation(int p_orient);
|
|
|
|
int get_screen_orientation() const;
|
|
|
|
String get_system_dir(int p_dir, bool p_shared_storage);
|
|
|
|
};
|
|
|
|
|
2022-03-23 20:46:05 +01:00
|
|
|
#endif /* !JAVA_PANDEMONIUM_IO_WRAPPER_H */
|