@preeternal/react-native-godot 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/Package.swift +106 -0
- package/README.md +631 -2
- package/android/build.gradle +289 -0
- package/android/consumer-rules.pro +19 -0
- package/android/fix-prefab.gradle +54 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/CMakeLists.txt +74 -0
- package/android/src/main/cpp/GodotModule.cpp +718 -0
- package/android/src/main/cpp/OnLoad.cpp +66 -0
- package/android/src/main/cpp/libgodot_android.h +79 -0
- package/android/src/main/cpp/libgodot_jni.cpp +585 -0
- package/android/src/main/cpp/libgodot_jni.h +130 -0
- package/android/src/main/cpp/native_godot_module_jni.cpp +86 -0
- package/android/src/main/cpp/native_godot_module_jni.h +58 -0
- package/android/src/main/java/com/preeternal/reactnativegodot/NativeGodotModuleModule.kt +83 -0
- package/android/src/main/java/com/preeternal/reactnativegodot/NativeGodotModulePackage.kt +41 -0
- package/android/src/main/java/com/preeternal/reactnativegodot/NativeLibraryLoader.kt +5 -0
- package/android/src/main/java/com/preeternal/reactnativegodot/RTNGodotView.kt +81 -0
- package/android/src/main/java/com/preeternal/reactnativegodot/RTNGodotViewManager.kt +34 -0
- package/android/src/main/java/com/preeternal/reactnativegodot/RTNLibGodot.kt +350 -0
- package/android/src/main/res/layout/downloading_expansion.xml +165 -0
- package/android/src/main/res/layout/godot_app_layout.xml +5 -0
- package/android/src/main/res/layout/snackbar.xml +27 -0
- package/android/src/main/res/layout/status_bar_ongoing_event_progress_bar.xml +108 -0
- package/android/src/main/res/mipmap/icon.png +0 -0
- package/android/src/main/res/mipmap/icon_background.png +0 -0
- package/android/src/main/res/mipmap/icon_foreground.png +0 -0
- package/android/src/main/res/mipmap/icon_monochrome.png +0 -0
- package/android/src/main/res/mipmap-anydpi-v26/icon.xml +8 -0
- package/android/src/main/res/mipmap-anydpi-v26/themed_icon.xml +11 -0
- package/android/src/main/res/mipmap-hdpi/icon.png +0 -0
- package/android/src/main/res/mipmap-hdpi/icon_background.png +0 -0
- package/android/src/main/res/mipmap-hdpi/icon_foreground.png +0 -0
- package/android/src/main/res/mipmap-hdpi/icon_monochrome.png +0 -0
- package/android/src/main/res/mipmap-mdpi/icon.png +0 -0
- package/android/src/main/res/mipmap-mdpi/icon_background.png +0 -0
- package/android/src/main/res/mipmap-mdpi/icon_foreground.png +0 -0
- package/android/src/main/res/mipmap-mdpi/icon_monochrome.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/icon.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/icon_background.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/icon_foreground.png +0 -0
- package/android/src/main/res/mipmap-xhdpi/icon_monochrome.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/icon.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/icon_background.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/icon_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxhdpi/icon_monochrome.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/icon.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/icon_background.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/icon_foreground.png +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/icon_monochrome.png +0 -0
- package/android/src/main/res/values/dimens.xml +9 -0
- package/android/src/main/res/values/strings.xml +61 -0
- package/android/src/main/res/values/styles.xml +25 -0
- package/android/src/main/res/values-fa/strings.xml +14 -0
- package/android/src/main/res/values-ko/strings.xml +54 -0
- package/android/src/main/res/xml/godot_provider_paths.xml +15 -0
- package/android/src/test/java/com/preeternal/reactnativegodot/NativeGodotModulePackageTest.kt +26 -0
- package/app.plugin.js +173 -0
- package/cpp/GodotModule.h +103 -0
- package/cpp/NativeGodotModule.cpp +825 -0
- package/cpp/NativeGodotModule.h +45 -0
- package/cpp/godot-log.h +64 -0
- package/ios/GodotModule.mm +661 -0
- package/ios/NativeGodotModuleProvider.h +35 -0
- package/ios/NativeGodotModuleProvider.mm +42 -0
- package/ios/RTNGodotView.h +42 -0
- package/ios/RTNGodotView.mm +711 -0
- package/ios/log.mm +38 -0
- package/lib/module/NativeNativeGodotModule.js +59 -0
- package/lib/module/NativeNativeGodotModule.js.map +1 -0
- package/lib/module/RTNGodotView.js +6 -0
- package/lib/module/RTNGodotView.js.map +1 -0
- package/lib/module/RTNGodotView.native.js +5 -0
- package/lib/module/RTNGodotView.native.js.map +1 -0
- package/lib/module/RTNGodotViewNativeComponent.ts +37 -0
- package/lib/module/index.js +30 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeNativeGodotModule.d.ts +26 -0
- package/lib/typescript/src/NativeNativeGodotModule.d.ts.map +1 -0
- package/lib/typescript/src/RTNGodotView.d.ts +7 -0
- package/lib/typescript/src/RTNGodotView.d.ts.map +1 -0
- package/lib/typescript/src/RTNGodotView.native.d.ts +3 -0
- package/lib/typescript/src/RTNGodotView.native.d.ts.map +1 -0
- package/lib/typescript/src/RTNGodotViewNativeComponent.d.ts +11 -0
- package/lib/typescript/src/RTNGodotViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +262 -4
- package/prebuilt-utils.rb +36 -0
- package/react-native-godot.podspec +41 -0
- package/react-native.config.js +15 -0
- package/scripts/check-16kb.sh +136 -0
- package/scripts/check-packaged-artifacts.sh +154 -0
- package/scripts/ci/verify-prebuilt-install.cjs +39 -0
- package/scripts/download-prebuilt.js +274 -0
- package/src/NativeNativeGodotModule.ts +90 -0
- package/src/RTNGodotView.native.tsx +2 -0
- package/src/RTNGodotView.tsx +12 -0
- package/src/RTNGodotViewNativeComponent.ts +37 -0
- package/src/index.tsx +28 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**************************************************************************/
|
|
2
|
+
/* OnLoad.cpp */
|
|
3
|
+
/**************************************************************************/
|
|
4
|
+
/* Copyright (c) 2024-2025 Slay GmbH */
|
|
5
|
+
/* */
|
|
6
|
+
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
7
|
+
/* a copy of this software and associated documentation files (the */
|
|
8
|
+
/* "Software"), to deal in the Software without restriction, including */
|
|
9
|
+
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
10
|
+
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
11
|
+
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
12
|
+
/* the following conditions: */
|
|
13
|
+
/* */
|
|
14
|
+
/* The above copyright notice and this permission notice shall be */
|
|
15
|
+
/* included in all copies or substantial portions of the Software. */
|
|
16
|
+
/* */
|
|
17
|
+
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
18
|
+
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
19
|
+
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
20
|
+
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
21
|
+
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
22
|
+
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
23
|
+
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
24
|
+
/**************************************************************************/
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the MIT license found in the
|
|
30
|
+
* LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
// This C++ file is part of the default configuration used by apps and is placed
|
|
34
|
+
// inside react-native to encapsulate it from user space (so you won't need to
|
|
35
|
+
// touch C++/Cmake code at all on Android).
|
|
36
|
+
//
|
|
37
|
+
// If you wish to customize it (because you want to manually link a C++ library
|
|
38
|
+
// or pass a custom compilation flag) you can:
|
|
39
|
+
//
|
|
40
|
+
// 1. Copy this CMake file inside the `android/app/src/main/jni` folder of your
|
|
41
|
+
// project
|
|
42
|
+
// 2. Copy the OnLoad.cpp (in this same folder) file inside the same folder as
|
|
43
|
+
// above.
|
|
44
|
+
// 3. Extend your `android/app/build.gradle` as follows
|
|
45
|
+
//
|
|
46
|
+
// android {
|
|
47
|
+
// // Other config here...
|
|
48
|
+
// externalNativeBuild {
|
|
49
|
+
// cmake {
|
|
50
|
+
// path "src/main/jni/CMakeLists.txt"
|
|
51
|
+
// }
|
|
52
|
+
// }
|
|
53
|
+
// }
|
|
54
|
+
|
|
55
|
+
#include "native_godot_module_jni.h"
|
|
56
|
+
#include "libgodot_jni.h"
|
|
57
|
+
#include <fbjni/fbjni.h>
|
|
58
|
+
|
|
59
|
+
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) {
|
|
60
|
+
// LibGodot threads can request a JNIEnv before the engine-level initialize
|
|
61
|
+
// callback runs, so retain the VM as soon as this shared library is loaded.
|
|
62
|
+
LibGodot::set_java_vm(vm);
|
|
63
|
+
return facebook::jni::initialize(vm, [] {
|
|
64
|
+
NativeGodotModuleJNI::registerNatives();
|
|
65
|
+
});
|
|
66
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**************************************************************************/
|
|
2
|
+
/* libgodot_android.h */
|
|
3
|
+
/**************************************************************************/
|
|
4
|
+
/* Copyright (c) 2024-2025 Slay GmbH */
|
|
5
|
+
/* */
|
|
6
|
+
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
7
|
+
/* a copy of this software and associated documentation files (the */
|
|
8
|
+
/* "Software"), to deal in the Software without restriction, including */
|
|
9
|
+
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
10
|
+
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
11
|
+
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
12
|
+
/* the following conditions: */
|
|
13
|
+
/* */
|
|
14
|
+
/* The above copyright notice and this permission notice shall be */
|
|
15
|
+
/* included in all copies or substantial portions of the Software. */
|
|
16
|
+
/* */
|
|
17
|
+
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
18
|
+
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
19
|
+
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
20
|
+
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
21
|
+
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
22
|
+
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
23
|
+
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
24
|
+
/**************************************************************************/
|
|
25
|
+
|
|
26
|
+
#ifndef LIBGODOT_ANDROID_H
|
|
27
|
+
#define LIBGODOT_ANDROID_H
|
|
28
|
+
|
|
29
|
+
#ifdef __cplusplus
|
|
30
|
+
extern "C" {
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
// Export macros for DLL visibility
|
|
34
|
+
#if defined(_MSC_VER) || defined(__MINGW32__)
|
|
35
|
+
#define LIBGODOT_API __declspec(dllexport)
|
|
36
|
+
#elif defined(__GNUC__) || defined(__clang__)
|
|
37
|
+
#define LIBGODOT_API __attribute__((visibility("default")))
|
|
38
|
+
#endif // if defined(_MSC_VER)
|
|
39
|
+
|
|
40
|
+
#if __has_include("core/extension/gdextension_interface.h")
|
|
41
|
+
#include "core/extension/gdextension_interface.h"
|
|
42
|
+
#elif __has_include("gdextension_interface.h")
|
|
43
|
+
#include "gdextension_interface.h"
|
|
44
|
+
#else
|
|
45
|
+
#error gdextension_interface.h is required
|
|
46
|
+
#endif
|
|
47
|
+
|
|
48
|
+
#include <jni.h>
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @name libgodot_create_godot_instance_android
|
|
52
|
+
* @since 4.4
|
|
53
|
+
*
|
|
54
|
+
* Creates a new Godot instance.
|
|
55
|
+
*
|
|
56
|
+
* @param p_argc The number of command line arguments.
|
|
57
|
+
* @param p_argv The C-style array of command line arguments.
|
|
58
|
+
* @param p_init_func GDExtension initialization function of the host application.
|
|
59
|
+
*
|
|
60
|
+
* @return A pointer to created \ref GodotInstance GDExtension object or nullptr if there was an error.
|
|
61
|
+
*/
|
|
62
|
+
LIBGODOT_API GDExtensionObjectPtr libgodot_create_godot_instance_android(int p_argc, char *p_argv[], GDExtensionInitializationFunction p_init_func, JNIEnv *env, jobject p_asset_manager, jobject p_net_utils, jobject p_directory_access_handler, jobject p_file_access_handler, jobject p_godot_io_wrapper, jobject p_godot_wrapper, jobject p_class_loader);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @name libgodot_destroy_godot_instance
|
|
66
|
+
* @since 4.4
|
|
67
|
+
*
|
|
68
|
+
* Destroys an existing Godot instance.
|
|
69
|
+
*
|
|
70
|
+
* @param p_godot_instance The reference to the GodotInstance object to destroy.
|
|
71
|
+
*
|
|
72
|
+
*/
|
|
73
|
+
LIBGODOT_API void libgodot_destroy_godot_instance(GDExtensionObjectPtr p_godot_instance);
|
|
74
|
+
|
|
75
|
+
#ifdef __cplusplus
|
|
76
|
+
}
|
|
77
|
+
#endif
|
|
78
|
+
|
|
79
|
+
#endif // LIBGODOT_ANDROID_H
|