You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
LibGodot: Core - Build Godot Engine as a Library
* Add a new GodotInstance GDCLASS that provides startup and iteration commands to control a Godot instance. * Adds a libgodot_create_godot_instance entry point that creates a new Godot instance and returns a GodotInstance object. * Adds a libgodot_destroy_godot_instance entry point that destroys the Godot instance. Sample Apps: https://github.com/migeran/libgodot_project Developed by [Migeran](https://migeran.com) Sponsors & Acknowledgements: * Initial development sponsored by [Smirk Software](https://www.smirk.gg/) * Rebasing to Godot 4.3 and further development sponsored by [Xibbon Inc.](https://xibbon.com) * The GDExtension registration of the host process & build system changes were based on @Faolan-Rad's LibGodot PR: https://github.com/godotengine/godot/pull/72883 * Thanks to Ben Rog-Wilhelm (Zorbathut) for creating a smaller, minimal version for easier review. * Thanks to Ernest Lee (iFire) for his support Co-Authored-By: Gabor Koncz <gabor.koncz@migeran.com> Co-Authored-By: Ben Rog-Wilhelm <zorba-github@pavlovian.net>
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
|
||||
#include "gdextension_manager.h"
|
||||
|
||||
#include "core/extension/gdextension_function_loader.h"
|
||||
#include "core/extension/gdextension_library_loader.h"
|
||||
#include "core/extension/gdextension_special_compat_hashes.h"
|
||||
#include "core/io/dir_access.h"
|
||||
@@ -114,7 +115,14 @@ GDExtensionManager::LoadStatus GDExtensionManager::load_extension(const String &
|
||||
|
||||
Ref<GDExtensionLibraryLoader> loader;
|
||||
loader.instantiate();
|
||||
return GDExtensionManager::get_singleton()->load_extension_with_loader(p_path, loader);
|
||||
return load_extension_with_loader(p_path, loader);
|
||||
}
|
||||
|
||||
GDExtensionManager::LoadStatus GDExtensionManager::load_extension_from_function(const String &p_path, GDExtensionConstPtr<const GDExtensionInitializationFunction> p_init_func) {
|
||||
Ref<GDExtensionFunctionLoader> func_loader;
|
||||
func_loader.instantiate();
|
||||
func_loader->set_initialization_function((GDExtensionInitializationFunction)*p_init_func.data);
|
||||
return load_extension_with_loader(p_path, func_loader);
|
||||
}
|
||||
|
||||
GDExtensionManager::LoadStatus GDExtensionManager::load_extension_with_loader(const String &p_path, const Ref<GDExtensionLoader> &p_loader) {
|
||||
@@ -454,6 +462,7 @@ GDExtensionManager *GDExtensionManager::get_singleton() {
|
||||
|
||||
void GDExtensionManager::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("load_extension", "path"), &GDExtensionManager::load_extension);
|
||||
ClassDB::bind_method(D_METHOD("load_extension_from_function", "path", "init_func"), &GDExtensionManager::load_extension_from_function);
|
||||
ClassDB::bind_method(D_METHOD("reload_extension", "path"), &GDExtensionManager::reload_extension);
|
||||
ClassDB::bind_method(D_METHOD("unload_extension", "path"), &GDExtensionManager::unload_extension);
|
||||
ClassDB::bind_method(D_METHOD("is_extension_loaded", "path"), &GDExtensionManager::is_extension_loaded);
|
||||
|
||||
Reference in New Issue
Block a user