Crate gdnative[−][src]
Rust bindings for the Godot game engine
This crate contains high-level wrappers around the Godot game engine's gdnaive API. Some of the types were automatically generated from the engine's JSON API description, and some other types are hand made wrappers around the core C types.
Memory management
Reference counting
A lot of the types provided by the engine are internally reference counted and
allow mutable aliasing.
In rust parlance this means that a type such as gdnative::ConcavePolygonShape2D
is functionally equivalent to a Rc<Cell<Something>>
rather than Rc<Something>
.
Since it is easy to expect containers and other types to allocate a copy of their
content when using the Clone
trait, most of these types do not implement Clone
and instead provide a new_ref(&self) -> Self
method to create references to the
same collection or object.
Manually managed objects
Some types are manually managed. This means that ownership can be passed to the
engine or the object must be carefully deallocated using the object's free
method.
Re-exports
pub use gdnative_core::*; |
pub use gdnative_common::*; |
pub use gdnative_graphics::*; |
pub use gdnative_physics::*; |
pub use gdnative_network::*; |
pub use gdnative_audio::*; |
pub use gdnative_video::*; |
pub use gdnative_editor::*; |
pub use gdnative_arvr::*; |
pub use gdnative_visual_script::*; |
pub use gdnative_animation::*; |
pub use gdnative_input::*; |
pub use gdnative_ui::*; |
Macros
godot_class |
Convenience macro to declare a native class. |
godot_error |
Print an error using the engine's logging system (visible in the editor). |
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_nativescript_init |
Declare the API endpoint to initialize nativescript classes on startup. |
godot_print |
Print a message using the engine's logging system (visible in the editor). |
godot_warn |
Print a warning using the engine's logging system (visible in the editor). |
godot_wrap_constructor |
Convenience macro to wrap an object's constructor into a function pointer that can be passed to the engine when registering a class. |
godot_wrap_destructor |
Convenience macro to wrap an object's destructor into a function pointer that can be passed to the engine when registering a class. |
godot_wrap_method |
Convenience macro to wrap an object's method into a function pointer that can be passed to the engine when registering a class. |