[][src]Crate gdnative_core

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 extern crate gdnative_geom as geom;

Modules

euclid

A collection of strongly typed math tools for computer graphics with an inclination towards 2d graphics and layout.

init

Types and functionalities to declare and initialize gdnative classes.

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.

Structs

Aabb

Axis-aligned bounding box.

Basis

A 3x3 matrix.

ByteArray

A reference-counted vector of bytes that uses Godot's pool allocator.

Color

RGBA color with 32 bits floating point components.

ColorArray

A reference-counted vector of ColorArray that uses Godot's pool allocator.

Dictionary

A reference-counted Dictionary of Variant key-value pairs.

Float32Array

A reference-counted vector of f32 that uses Godot's pool allocator.

FreeOnDrop

A wrapper that automatically frees the object when dropped.

GodotString

Godot's reference-counted string type.

Int32Array

A reference-counted vector of i32 that uses Godot's pool allocator.

NativeInstanceHeader

Godot native class implementation detail that must be stored in each instance.

NativeRef

A reference to a rust native script.

NodePath

A reference-counted relative or absolute path in a scene tree, for use with Node.get_node() and similar functions. It can reference a node, a resource within a node, or a property of a node or resource.

Object

The base class of most Godot classes.

Plane

Plane in hessian form.

QueueFreeOnDrop

A wrapper that automatically enqueues the object for deletion when dropped.

Reference

Base class of all reference-counted types. Inherits Object.

Rid

The RID type is used to access the unique integer ID of a resource. They are opaque, so they do not grant access to the associated resource by themselves.

StringArray

A vector of GodotString that uses Godot's pool allocator.

StringName
Transform

3D Transformation (3x4 matrix) Using basis + origin representation.

Variant

A Variant can represent many of godot's core types.

VariantArray

A reference-counted Variant vector. Godot's generic array data type. Negative indices can be used to count from the right.

Vector2Array

A reference-counted vector of Vector2 that uses Godot's pool allocator.

Vector3Array

A reference-counted vector of Vector3 that uses Godot's pool allocator.

Enums

GodotError
ObjectConnectFlags
VariantOperator
VariantType
Vector3Axis

Traits

Free

Manually managed Godot classes implementing free.

GodotObject

Internal details.

NativeClass
QueueFree

Manually managed Godot classes implementing queue_free.

ToVariant

Types that can be converted to and from a Variant.

Functions

result_from_sys

Type Definitions

GodotResult
Quat
Rect2
Transform2D
Vector2
Vector3