Module gdnative_core::init
source · Expand description
Global initialization and termination of the library.
This module provides all the plumbing required for global initialization and shutdown of godot-rust.
Init and exit hooks
Three endpoints are automatically invoked by the engine during startup and shutdown:
All three must be present. To quickly define all three endpoints using the default names,
use godot_init
.
Registering script classes
InitHandle
is the registry of all your exported symbols.
To register script classes, call InitHandle::add_class()
or InitHandle::add_tool_class()
in your godot_nativescript_init
or godot_init
callback:
use gdnative::prelude::*;
#[derive(NativeClass)]
struct HelloWorld { /* ... */ }
#[methods]
impl HelloWorld { /* ... */ }
fn init(handle: InitHandle) {
handle.add_class::<HelloWorld>();
}
godot_init!(init);
Modules
Run-time tracing functions to help debug the init process.
Macros
Declare the API endpoint to initialize the gdnative API on startup.
Declare the API endpoint invoked during shutdown.
Declare all the API endpoints necessary to initialize a NativeScript library.
Declare the API endpoint to initialize export classes on startup.
Structs
A handle that can register new classes to the engine during initialization.
Context for the
godot_gdnative_init
callback.Context for the
godot_gdnative_terminate
callback.