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§
- diagnostics
- Run-time tracing functions to help debug the init process.
Macros§
- godot_
gdnative_ init - Declare the API endpoint to initialize the gdnative API on startup.
- godot_
gdnative_ terminate - Declare the API endpoint invoked during shutdown.
- godot_
init - Declare all the API endpoints necessary to initialize a NativeScript library.
- godot_
nativescript_ init - Declare the API endpoint to initialize export classes on startup.
Structs§
- Init
Handle - A handle that can register new classes to the engine during initialization.
- Initialize
Info - Context for the
godot_gdnative_init
callback. - Terminate
Info - Context for the
godot_gdnative_terminate
callback.