gdext.builtin

package gdext.builtin

Members list

Type members

Classlikes

final case class AABB(position: Vector3, size: Vector3)

Godot's AABB: an axis-aligned box, position and size (24 bytes).

Godot's AABB: an axis-aligned box, position and size (24 bytes).

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object AABB

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
AABB.type
final class Arr[A] extends AutoCloseable

A typed view over Godot's GArray — Arr[A]. Elements marshal through the ToVariant/FromVariant seam, so any builtin- or (where a given exists) object-convertible A works. The sibling of Dict for sequences.

A typed view over Godot's GArray — Arr[A]. Elements marshal through the ToVariant/FromVariant seam, so any builtin- or (where a given exists) object-convertible A works. The sibling of Dict for sequences.

The backing 8-byte Array handle is heap-owned so an Arr can live in a class field (an exported property) for the object's lifetime. As with the rest of the binding, freeing is explicit / process-lifetime (Phase 4 lifetimes).

Attributes

Companion
object
Supertypes
trait AutoCloseable
class Object
trait Matchable
class Any
object Arr

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Arr.type
final case class Basis(xx: Float, xy: Float, xz: Float, yx: Float, yy: Float, yz: Float, zx: Float, zy: Float, zz: Float)

Godot's Basis: a 3x3 matrix, stored flat so one value is one object.

Godot's Basis: a 3x3 matrix, stored flat so one value is one object.

Fields are named by column, as in GDScript: column x is (xx, xy, xz), y is (yx, yy, yz), z is (zx, zy, zz). The engine stores rows, so row 0 is (xx, yx, zx). Euler order values follow Godot's EulerOrder (0 XYZ, 1 XZY, 2 YXZ, 3 YZX, 4 ZXY, 5 ZYX).

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Basis

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Basis.type

Caches ptrcall function pointers for builtin-type methods (Array.size, Dictionary.keys, ...). Resolving one requires the type, a StringName of the method, and the method's hash from extension_api.json; the resulting function pointer is stable for the process, so it is memoized.

Caches ptrcall function pointers for builtin-type methods (Array.size, Dictionary.keys, ...). Resolving one requires the type, a StringName of the method, and the method's hash from extension_api.json; the resulting function pointer is stable for the process, so it is memoized.

This is the builtin-type analogue of the engine-class method binding Phase 2 will generate; it is kept minimal here to support the Phase 1 containers.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Self-test exercised from the SCENE initialize callback. Round-trips values through Variant and reports PASS/FAIL lines via the supplied logger.

Self-test exercised from the SCENE initialize callback. Round-trips values through Variant and reports PASS/FAIL lines via the supplied logger.

This runs against the live engine, so it is the real proof that the Variant marshalling (constructor cache, buffer sizes, type-pointer layout) is correct — something no amount of sbt compile can establish.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object BuiltinSizes

Byte sizes of Godot's builtin (Variant) types for the float_64 build configuration (Godot's default desktop build), from the API dump's builtin_class_sizes. These types are opaque blobs on the GDExtension boundary: the binding allocates exactly this many bytes and hands Godot a pointer, so a wrong size corrupts memory silently.

Byte sizes of Godot's builtin (Variant) types for the float_64 build configuration (Godot's default desktop build), from the API dump's builtin_class_sizes. These types are opaque blobs on the GDExtension boundary: the binding allocates exactly this many bytes and hands Godot a pointer, so a wrong size corrupts memory silently.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object Callable

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Callable.type
final case class Color(r: Float, g: Float, b: Float, a: Float = ...)

Godot's Color: RGBA as single-precision floats (16 bytes), usually in 0..1. The named colors (Color.RED, Color.ALICE_BLUE, ...) come from the engine's API dump; see ColorNames.

Godot's Color: RGBA as single-precision floats (16 bytes), usually in 0..1. The named colors (Color.RED, Color.ALICE_BLUE, ...) come from the engine's API dump; see ColorNames.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Color

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Color.type
object ColorNames

Godot's named colors, reachable as Color.RED, Color.ALICE_BLUE, ...

Godot's named colors, reachable as Color.RED, Color.ALICE_BLUE, ...

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
ColorNames.type
final class Dict[K, V] extends AutoCloseable

A typed view over Godot's Dictionary — Dict[K, V]. Keys and values marshal through the ToVariant/FromVariant seam, so any builtin- or (where a given exists) object-convertible K/V works.

A typed view over Godot's Dictionary — Dict[K, V]. Keys and values marshal through the ToVariant/FromVariant seam, so any builtin- or (where a given exists) object-convertible K/V works.

The backing 8-byte Dictionary handle is heap-owned so a Dict can live in a class field (an exported property) for the object's lifetime. As with the rest of the binding, freeing is explicit / process-lifetime (Phase 4 lifetimes).

Attributes

Companion
object
Supertypes
trait AutoCloseable
class Object
trait Matchable
class Any
object Dict

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Dict.type
object Dictionary

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Dictionary.type
trait FromVariant[A]

Decodes a Scala value out of a Godot Variant.

Decodes a Scala value out of a Godot Variant.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object FromVariant

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
object GArray

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
GArray.type
object GString

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
GString.type
object GodotMath

Godot's scalar math helpers (core/math/math_funcs.h), in single precision like the engine's real_t. The math builtins are built on these, so their results match the engine's own implementations.

Godot's scalar math helpers (core/math/math_funcs.h), in single precision like the engine's real_t. The math builtins are built on these, so their results match the engine's own implementations.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
GodotMath.type

Reads the property names of an arbitrary engine object via Object.get_property_list.

Reads the property names of an arbitrary engine object via Object.get_property_list.

Object.get_property_list returns typedarray::Dictionary (ABI-identical to an untyped Array of Dictionary), which the code generator drops — so this is the bespoke reader. It ptrcalls the bind into an Array buffer, then reads each element Dictionary's "name" key (a String). Used to enumerate an AnimationTree's parameters/... paths, which have no dedicated list method.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
sealed abstract class PackedArray[E] extends AutoCloseable

Heap-owned PackedFloat32Array / PackedVector3Array values. The 16-byte handle lives in malloc'd storage so the value can outlive a call frame; call free when done (destroys the engine value and releases the storage).

Heap-owned PackedFloat32Array / PackedVector3Array values. The 16-byte handle lives in malloc'd storage so the value can outlive a call frame; call free when done (destroys the engine value and releases the storage).

Element access goes through the packed_*_operator_index interface functions, which return an interior pointer (the non-const variant triggers copy-on-write first). Indices are bounds-checked on the Scala side: the engine returns null for an out-of-range index, and dereferencing that segfaults.

Attributes

Companion
object
Supertypes
trait AutoCloseable
class Object
trait Matchable
class Any
Known subtypes
object PackedArray

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final class PackedFloat32Array extends PackedArray[Float]

Attributes

Companion
object
Supertypes
class PackedArray[Float]
trait AutoCloseable
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final class PackedInt32Array extends PackedArray[Int]

Attributes

Companion
object
Supertypes
class PackedArray[Int]
trait AutoCloseable
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type

Reads a PackedStringArray returned by a no-argument engine method into a Scala Seq[String].

Reads a PackedStringArray returned by a no-argument engine method into a Scala Seq[String].

The code generator drops methods whose return type is PackedStringArray (the Ptrcall seam has no case for it), so the few we need — AnimationMixer.get_animation_list, SpriteFrames.get_animation_names — are unreachable through generated wrappers. This is the bespoke reader for them: call the bind via object_method_bind_ptrcall into a heap-sized buffer, read the element count via the PackedStringArray.size builtin method, then decode each element through packed_string_array_operator_index (which hands back an interior pointer to the element String — read it, never destroy it). The array value itself is owned by us and destroyed when done.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final class PackedVector3Array extends PackedArray[Vector3]

Attributes

Companion
object
Supertypes
trait AutoCloseable
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final case class Plane(normal: Vector3, d: Float)

Godot's Plane: a normal and the distance d from the origin (16 bytes).

Godot's Plane: a normal and the distance d from the origin (16 bytes).

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Plane

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Plane.type
final case class Projection(xx: Float, xy: Float, xz: Float, xw: Float, yx: Float, yy: Float, yz: Float, yw: Float, zx: Float, zy: Float, zz: Float, zw: Float, wx: Float, wy: Float, wz: Float, ww: Float)

Godot's Projection: a 4x4 matrix of columns x, y, z, w (each a Vector4), stored flat (16 floats) so one value is one object. Field xy is column x, component y. Plane indices for getProjectionPlane: 0 near, 1 far, 2 left, 3 top, 4 right, 5 bottom.

Godot's Projection: a 4x4 matrix of columns x, y, z, w (each a Vector4), stored flat (16 floats) so one value is one object. Field xy is column x, component y. Plane indices for getProjectionPlane: 0 near, 1 far, 2 left, 3 top, 4 right, 5 bottom.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Projection

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Projection.type
final case class Quaternion(x: Float, y: Float, z: Float, w: Float)

Godot's Quaternion: a rotation as (x, y, z, w) (16 bytes).

Godot's Quaternion: a rotation as (x, y, z, w) (16 bytes).

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Quaternion

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Quaternion.type
final case class Rect2(position: Vector2, size: Vector2)

Godot's Rect2: a position and a size (16 bytes).

Godot's Rect2: a position and a size (16 bytes).

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Rect2

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Rect2.type
final case class Rect2i(position: Vector2i, size: Vector2i)

Godot's Rect2i: an integer position and size (16 bytes).

Godot's Rect2i: an integer position and size (16 bytes).

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Rect2i

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Rect2i.type
object StringName

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
StringName.type
object StringNames

Process-lifetime cache of StringNames keyed by their Scala string.

Process-lifetime cache of StringNames keyed by their Scala string.

Entries are allocated with libc malloc (not the GC) so the 8-byte handle has a stable address for the whole process and is never moved or collected; they are intentionally never freed (the cache lives as long as the extension). This mirrors how name interning is meant to be used.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
trait ToVariant[A]

Encodes a Scala value into a (caller-allocated) Godot Variant.

Encodes a Scala value into a (caller-allocated) Godot Variant.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object ToVariant

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
ToVariant.type
final case class Transform2D(xx: Float, xy: Float, yx: Float, yy: Float, ox: Float, oy: Float)

Godot's Transform2D: columns x = (xx, xy), y = (yx, yy) and origin = (ox, oy), stored flat (6 floats) so one value is one object.

Godot's Transform2D: columns x = (xx, xy), y = (yx, yy) and origin = (ox, oy), stored flat (6 floats) so one value is one object.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Transform2D

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class Transform3D(xx: Float, xy: Float, xz: Float, yx: Float, yy: Float, yz: Float, zx: Float, zy: Float, zz: Float, ox: Float, oy: Float, oz: Float)

Godot's Transform3D: a Basis plus an origin, stored flat (12 floats) so one value is one object. Basis fields are named by column as in Basis; ox, oy, oz is the origin. basis and origin build views on demand.

Godot's Transform3D: a Basis plus an origin, stored flat (12 floats) so one value is one object. Basis fields are named by column as in Basis; ox, oy, oz is the origin. basis and origin build views on demand.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Transform3D

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
object Variant

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Variant.type

Caches the engine's per-type Variant constructor functions.

Caches the engine's per-type Variant constructor functions.

get_variant_from_type_constructor / ..._to_type_constructor are relatively expensive lookups, but the function pointer they return is stable for the lifetime of the process. gdext caches these in a table indexed by variant type; we do the same.

Variant type tags are small contiguous integers (NIL=0 .. MAX), so a flat array indexed by the tag is the natural cache. The cache is populated lazily on first use of each type and never invalidated.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object VariantIO

Primitive Variant reads and writes at Long addresses, for the registration trampolines: no Ptr crosses a method boundary and no primitive is boxed, so a call allocates nothing. Internal: public only because inlined registration code in game projects references it.

Primitive Variant reads and writes at Long addresses, for the registration trampolines: no Ptr crosses a method boundary and no primitive is boxed, so a call allocates nothing. Internal: public only because inlined registration code in game projects references it.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
VariantIO.type
final case class Vector2(x: Float, y: Float)

Godot's Vector2: two single-precision components (8 bytes). The whole engine API is implemented in Scala (ported from core/math), so no method calls into the engine. Zero-argument methods take no parentheses.

Godot's Vector2: two single-precision components (8 bytes). The whole engine API is implemented in Scala (ported from core/math), so no method calls into the engine. Zero-argument methods take no parentheses.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Vector2

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Vector2.type
final case class Vector2i(x: Int, y: Int)

Godot's Vector2i: two 32-bit integer components (8 bytes).

Godot's Vector2i: two 32-bit integer components (8 bytes).

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Vector2i

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Vector2i.type
final case class Vector3(x: Float, y: Float, z: Float)

Godot's Vector3: three single-precision components (12 bytes). The whole engine API is implemented in Scala (ported from core/math).

Godot's Vector3: three single-precision components (12 bytes). The whole engine API is implemented in Scala (ported from core/math).

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Vector3

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Vector3.type
final case class Vector3i(x: Int, y: Int, z: Int)

Godot's Vector3i: three 32-bit integer components (12 bytes).

Godot's Vector3i: three 32-bit integer components (12 bytes).

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Vector3i

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Vector3i.type
final case class Vector4(x: Float, y: Float, z: Float, w: Float)

Godot's Vector4: four single-precision components (16 bytes).

Godot's Vector4: four single-precision components (16 bytes).

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Vector4

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Vector4.type
final case class Vector4i(x: Int, y: Int, z: Int, w: Int)

Godot's Vector4i: four 32-bit integer components (16 bytes).

Godot's Vector4i: four 32-bit integer components (16 bytes).

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Vector4i

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Vector4i.type

Types

opaque type Callable

Godot's Callable (16 bytes, BuiltinSizes.Callable).

Godot's Callable (16 bytes, BuiltinSizes.Callable).

Built bound to an object + method name via the engine's builtin constructor (Callable constructor index 2 = (Object, StringName)). When the engine later invokes it — e.g. a connected signal fires — it calls that method on that object. For one of our registered classes, that routes back into Scala through the method-call trampoline (so the bound method must be registered, e.g. via gdext.internal.register.MethodRegistration).

Represented as a pointer to its 16-byte storage, like StringName.

Attributes

opaque type Dictionary

Godot's Dictionary. An 8-byte (BuiltinSizes.Dictionary) reference- counted handle.

Godot's Dictionary. An 8-byte (BuiltinSizes.Dictionary) reference- counted handle.

dictionary_operator_index returns a pointer to the Variant slot for a key, inserting a nil slot if the key is absent — so it serves both get and the lvalue side of set. size/has go through the builtin-method machinery, same as GArray.

Attributes

opaque type GArray

Godot's untyped Array. An 8-byte (BuiltinSizes.Array) reference-counted handle to a heap-backed variant array.

Godot's untyped Array. An 8-byte (BuiltinSizes.Array) reference-counted handle to a heap-backed variant array.

Element access uses array_operator_index, which hands back a pointer to the Variant slot inside the array (no copy). Mutating operations (push_back, size, ...) go through the engine's builtin-method machinery, keyed by the method hashes baked from extension_api.json (Godot 4.5). Phase 2 will generate these hash constants rather than hand-listing them.

Attributes

opaque type GString

Godot's String (named GString to avoid clashing with scala.String).

Godot's String (named GString to avoid clashing with scala.String).

Physically an 8-byte (BuiltinSizes.String) reference-counted handle. Conversion in both directions copies UTF-16 code units (Scala's own string representation) through the *_utf16_* interface functions, using the two-call length probe for reads.

Strings are reference-counted, so a constructed GString must be destroyed when no longer needed; GString.scope does this automatically.

Attributes

opaque type StringName

Godot's StringName — an interned, 8-byte (BuiltinSizes.StringName) reference-counted handle used pervasively for method, class, property and signal names. Lookups by StringName are O(1) pointer comparisons engine-side, which is why every classdb/method API takes one.

Godot's StringName — an interned, 8-byte (BuiltinSizes.StringName) reference-counted handle used pervasively for method, class, property and signal names. Lookups by StringName are O(1) pointer comparisons engine-side, which is why every classdb/method API takes one.

Because the same names (class names, method names) are used over and over, StringNames are cached for the process lifetime via StringNames.cached rather than rebuilt per call — gdext does the same.

Attributes

opaque type Variant

A Godot Variant — the dynamically-typed value all of Godot's scripting and reflection traffics in.

A Godot Variant — the dynamically-typed value all of Godot's scripting and reflection traffics in.

Physically this is a ptr to a BuiltinSizes.Variant-byte buffer that Godot owns the contents of. Constructing a Variant from a value, and reading a value back out, go through the engine's per-type constructor functions (cached in VariantConstructors), matching gdext's approach exactly.

Memory: the backing buffer here is provided by the caller (typically stack- allocated within a Variant.scope). A Variant may hold a reference-counted payload (e.g. a String or Object), so when you are done with one you must destroy it to release that payload; the buffer itself is reclaimed by whoever allocated it.

Attributes