gdext.internal.engine

Members list

Type members

Classlikes

final class CachedBind(className: String, methodName: String, hash: Long)

A method bind resolved on first use and then read from a field.

A method bind resolved on first use and then read from a field.

Attributes

Supertypes
class Object
trait Matchable
class Any
trait ClassMeta[T]

Minimal type-directed metadata for a Godot class T (an engine wrapper or a user-registered class). This is all that remains of the old GodotClass[T] typeclass once Gd[T] is gone: the only thing the rest of the binding still needs at a type boundary is the ability to turn a raw engine handle into a typed T wrapper (plus the class name for string-keyed engine calls).

Minimal type-directed metadata for a Godot class T (an engine wrapper or a user-registered class). This is all that remains of the old GodotClass[T] typeclass once Gd[T] is gone: the only thing the rest of the binding still needs at a type boundary is the ability to turn a raw engine handle into a typed T wrapper (plus the class name for string-keyed engine calls).

  • className — the Godot class name, for class-tag / construct lookups.
  • fromHandle — the object's one wrapper as a T (its bound user instance, else a cached wrapper of its most-derived engine class; see Wrappers).

Dropped vs GodotClass: isRefCounted (now value.isInstanceOf[RefCounted]) and unwrap (now t.hostObject/t.hostPtr directly on the value).

There are no hand-written or generated instances. Every ClassMeta[T] is synthesized by the single derived macro from the type T, so adding an engine class or a user class needs no boilerplate. ClassMeta is only ever summoned at a handle→object boundary (cast targets, export reads, construction); once you hold a T, you never need it again.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object ClassMeta

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
ClassMeta.type
object ClassTags

Caches per-class "class tags" used by object_cast_to.

Caches per-class "class tags" used by object_cast_to.

classdb_get_class_tag(name) returns an opaque token identifying a class in ClassDB; object_cast_to(obj, tag) returns the object if it is-a that class (else null). The tag is stable, so we memoize it per class name.

Attributes

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

Builds a Godot Callable backed by a Scala closure (a custom callable), via the GDExtension callable_custom_create2 interface. This lets game code connect a signal to a lambda directly — no registered @func method and no string method name.

Builds a Godot Callable backed by a Scala closure (a custom callable), via the GDExtension callable_custom_create2 interface. This lets game code connect a signal to a lambda directly — no registered @func method and no string method name.

How the closure survives the FFI boundary: Scala Native CFuncPtrs must be non-capturing, so the trampolines below are static and the closure lives in a registry keyed by a generated id. That id is what we hand Godot as the opaque callable_userdata pointer (packed via Tokens, exactly like the class/instance tokens — the GC never chases a fabricated pointer because the closure is kept alive by the registry, not the pointer). Each trampoline reads the id back to find its closure; free_func drops the registry entry when Godot frees the Callable, so the closure is reachable for exactly as long as the engine holds it.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final class Dyn extends AutoCloseable

A heap-held Variant, for dynamic engine calls outside the typed API (test harnesses comparing the Scala math library with the engine's). Release with close().

A heap-held Variant, for dynamic engine calls outside the typed API (test harnesses comparing the Scala math library with the engine's). Release with close().

Attributes

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

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Dyn.type

Exercises the generated engine-class wrappers against the live engine — the real proof that codegen output works end to end (singleton lookup, cached method binds, ptrcall marshalling of primitives, builtins, objects and strings).

Exercises the generated engine-class wrappers against the live engine — the real proof that codegen output works end to end (singleton lookup, cached method binds, ptrcall marshalling of primitives, builtins, objects and strings).

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object GdSelfTest

Exercises the object model against the live engine: construction via Gd.create, instance ids, manual free, reference-counting, and up/down casts. An engine object is now held as its plain wrapper type (Node2D, …) — there is no Gd[T] smart pointer — so a null reference is the absent/failed-cast sentinel and the lifetime methods are called directly on the wrapper.

Exercises the object model against the live engine: construction via Gd.create, instance ids, manual free, reference-counting, and up/down casts. An engine object is now held as its plain wrapper type (Node2D, …) — there is no Gd[T] smart pointer — so a null reference is the absent/failed-cast sentinel and the lifetime methods are called directly on the wrapper.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
GdSelfTest.type
object GodotObject

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object InstanceId

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
InstanceId.type
object Marshal

Compile-time marshalling for engine method ptrcalls.

Compile-time marshalling for engine method ptrcalls.

ptrcall passes each argument as a pointer to its native representation (an int64, a double, a Vector2's 8 bytes, an object pointer, ...) and writes the return value's native representation into a caller-provided buffer.

Every method here is inline and dispatches on the static type with erasedValue, so a call site expands to straight-line code for its exact types: no typeclass instances, no boxing of primitives or Ptr-backed opaque types, no heap allocation. Argument and return buffers live on the stack of the (non-inline) calling method.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Marshal.type
object MethodBind

Resolves and caches engine MethodBind pointers.

Resolves and caches engine MethodBind pointers.

classdb_get_method_bind(class, method, hash) is a dictionary lookup; the returned bind is stable for the process. get is the cold path: generated engine-class wrappers keep one null-checked bind field per method in their companion and call it once, and hand-written callers hold a CachedBind. The (class, method, hash) hash uniquely identifies an ABI-compatible method version, which is how Godot keeps GDExtensions working across point releases.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
MethodBind.type
object ObjectRef

Internal construction helper for live engine-object references, now that an object is held as its plain wrapper type (Node2D, PlayerStats) rather than a Gd[T]. The user-facing entry point is gdext.api.Gd.create, which forwards here.

Internal construction helper for live engine-object references, now that an object is held as its plain wrapper type (Node2D, PlayerStats) rather than a Gd[T]. The user-facing entry point is gdext.api.Gd.create, which forwards here.

(OBJECT-Variant marshalling givens live in object GodotScriptClass so they are found by implicit search for any T <: GodotScriptClass.)

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
ObjectRef.type
object ObjectVariant

Marshalling for OBJECT-typed Variants (node / resource / scene references).

Marshalling for OBJECT-typed Variants (node / resource / scene references).

Unlike value builtins, the "type pointer" for an OBJECT is a pointer to the 8-byte engine object handle. We write/read that handle through the cached per-type Variant constructors, exactly as ToVariant's fromBuiltin does for value types. A null handle round-trips as a NIL/empty object Variant.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object Ptrcall

Fixed-arity ptrcall dispatchers used by the generated engine wrappers.

Fixed-arity ptrcall dispatchers used by the generated engine wrappers.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Ptrcall.type
final class Required[A]

A reference that is meant to be assigned; get throws if unassigned.

A reference that is meant to be assigned; get throws if unassigned.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Required

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Required.type
object Signals

Signal-connection helper. Object.connect takes a Callable argument, which the codegen does not emit a wrapper for, so we bind it directly here via its MethodBind. Pairs with gdext.builtin.Callable.of to route an engine signal back into a registered class's Scala method.

Signal-connection helper. Object.connect takes a Callable argument, which the codegen does not emit a wrapper for, so we bind it directly here via its MethodBind. Pairs with gdext.builtin.Callable.of to route an engine signal back into a registered class's Scala method.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Signals.type
final class Tres[T <: GodotScriptClass]

A typed Resource reference (export hint RESOURCE_TYPE = T). Holds the bare resource wrapper directly; a null raw is unassigned.

A typed Resource reference (export hint RESOURCE_TYPE = T). Holds the bare resource wrapper directly; a null raw is unassigned.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Tres

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Tres.type
final class Tscn[T <: GodotScriptClass]

A PackedScene typed by its root node type T. Editor-side filtering to scenes whose root is T is provided by the inspector plugin; here the type gives a typed instantiate and a runtime root-type check.

A PackedScene typed by its root node type T. Editor-side filtering to scenes whose root is T is provided by the inspector plugin; here the type gives a typed instantiate and a runtime root-type check.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Tscn

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Tscn.type
object VariantCall

Dynamic (Variant) engine calls: methods, statics, operators, members.

Dynamic (Variant) engine calls: methods, statics, operators, members.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object Wrappers

One Scala wrapper per engine object, cached on the object itself through Godot's instance bindings (the godot-cpp mechanism).

One Scala wrapper per engine object, cached on the object itself through Godot's instance bindings (the godot-cpp mechanism).

The first time an object is wrapped, Godot calls createCallback: it returns the object's bound user instance if it has one, else a fresh wrapper of the object's most-derived generated class (gdext.classes.ClassFactory). Later wraps are a single object_get_instance_binding call: no allocation, and the same wrapper every time. When the engine frees the object, Godot calls freeCallback, which clears the wrapper's handle, so calling a method on it throws instead of touching freed memory.

The binding is a gdext.internal.SlotTable token, never a raw Scala address, so the GC always sees the wrapper through the table.

Attributes

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

Types

opaque type GodotObject

A thin opaque view over the raw engine-object handle, used at FFI boundaries (object-typed method args/returns, the ClassMeta.fromHandle factory). The typed wrappers themselves (Node, Node2D, ...) are abstract classes that carry this handle via gdext.internal.register.GodotScriptClass and own the lifetime/ref-counting operations (free/unref/refInc/cast).

A thin opaque view over the raw engine-object handle, used at FFI boundaries (object-typed method args/returns, the ClassMeta.fromHandle factory). The typed wrappers themselves (Node, Node2D, ...) are abstract classes that carry this handle via gdext.internal.register.GodotScriptClass and own the lifetime/ref-counting operations (free/unref/refInc/cast).

A null handle is the engine's "no object" / failed-cast sentinel.

Attributes

opaque type InstanceId

A Godot object's stable instance id — the Scala analogue of gdext's InstanceId.

A Godot object's stable instance id — the Scala analogue of gdext's InstanceId.

Godot assigns every Object a process-unique, non-zero id that stays valid for the object's lifetime. It is exposed over the C ABI as a u64; Godot has no public accessor for the raw u64, only the i64 form, so this type carries the i64 (a reinterpreted-but-lossless view of the same bits) and exposes it via toI64 / toLong. A zero value is the null/invalid sentinel.

Attributes