Path: blob/master/platform/android/java_godot_io_wrapper.h
10277 views
/**************************************************************************/1/* java_godot_io_wrapper.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 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/**************************************************************************/2930#pragma once3132#include "jni_utils.h"3334#include "core/math/rect2i.h"35#include "core/variant/typed_array.h"3637#include <android/log.h>38#include <jni.h>3940// Class that makes functions in java/src/org/godotengine/godot/GodotIO.java callable from C++41class GodotIOJavaWrapper {42private:43jobject godot_io_instance;44jclass cls;4546jmethodID _open_URI = 0;47jmethodID _get_cache_dir = 0;48jmethodID _get_data_dir = 0;49jmethodID _get_temp_dir = 0;50jmethodID _get_display_cutouts = 0;51jmethodID _get_display_rotation = 0;52jmethodID _get_display_safe_area = 0;53jmethodID _get_locale = 0;54jmethodID _get_model = 0;55jmethodID _get_screen_DPI = 0;56jmethodID _get_scaled_density = 0;57jmethodID _get_screen_refresh_rate = 0;58jmethodID _get_unique_id = 0;59jmethodID _show_keyboard = 0;60jmethodID _hide_keyboard = 0;61jmethodID _has_hardware_keyboard = 0;62jmethodID _set_screen_orientation = 0;63jmethodID _get_screen_orientation = 0;64jmethodID _get_system_dir = 0;6566public:67GodotIOJavaWrapper(JNIEnv *p_env, jobject p_godot_io_instance);68~GodotIOJavaWrapper();6970jobject get_instance();7172Error open_uri(const String &p_uri);73String get_cache_dir();74String get_temp_dir();75String get_user_data_dir(const String &p_user_dir);76String get_locale();77String get_model();78int get_screen_dpi();79float get_scaled_density();80float get_screen_refresh_rate(float fallback);81TypedArray<Rect2> get_display_cutouts();82Rect2i get_display_safe_area();83String get_unique_id();84bool has_vk();85bool has_hardware_keyboard();86void show_vk(const String &p_existing, int p_type, int p_max_input_length, int p_cursor_start, int p_cursor_end);87void hide_vk();88int get_vk_height();89void set_vk_height(int p_height);90void set_screen_orientation(int p_orient);91int get_screen_orientation();92String get_system_dir(int p_dir, bool p_shared_storage);93int get_display_rotation();94};959697