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);
Re-exports
pub use crate::godot_gdnative_init;
pub use crate::godot_gdnative_terminate;
pub use crate::godot_init;
pub use crate::godot_nativescript_init;
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.