Top Level Namespace
Defined in:
Method Summary
-
crystal_godot_init(api : Pointer(Godot::LibBridge::BridgeAPI)) : Void
C ABI Entry point called by crystal_bridge when game library is loaded
-
load(path : String, type_hint : String = "", cache_mode : Int64 = 0_i64) : Godot::Resource
Global convenience helper to load resources from Godot VFS
-
preload(path : String) : Godot::Resource
Global convenience helper to preload resources from Godot VFS
-
vec2(x : Number, y : Number) : Vector2
Top-level math constructors
- vec3(x : Number, y : Number, z : Number) : Vector3
Macro Summary
-
abstract_class
Convenience macro to designate a class as abstract in Godot.
-
await(target, signal_name = nil, timeout_sec = nil)
Top-level await macro for intuitive GDScript-like calling syntax Usage: await(enemy.died) await(enemy.died, timeout_sec: 2.0) await(enemy, "died") await(enemy, "died", timeout_sec: 2.0) await(timer.timeout) await(timer) await(1.5) await(2.seconds)
-
export_category(name, &block)
Categories group top-level inspector sections in Godot.
-
export_group(name, prefix = "", &block)
Groups exported properties in the Godot inspector.
-
export_subgroup(name, prefix = "", &block)
Subgroups exported properties under the current inspector group.
-
gdclass(decl, &block)
Declares a custom RefCounted or generic Godot engine class registered with ClassDB.
-
group(*group_names)
Declaratively assigns the node to one or more scene tree groups upon
_ready. -
icon(path)
Convenience macro to set a custom icon path in the editor.
-
node(decl, &block)
The primary
nodemacro: Usage: node MyNode node MyNode do # defaults to Godot::Node end -
node_path!(path)
Creates a compile-time verified Godot::NodePath
-
onready(decl)
Declares an
@onreadynode property initialized from the scene tree during_ready. -
onready(name, type, path = nil)
Declares a lazy-cached node property matching Godot's
@onreadypattern. -
resource(decl, &block)
Declares a custom Godot Resource class registered with ClassDB and EditorHelp.
-
signal(sig_decl)
Declares a custom Godot signal and generates a type-safe
emit_<signal_name>helper method. -
static_unload
Convenience macro to mark extension library unloading behavior.
-
unique_node(name, type, unique_name = nil)
Declares a lazy-cached Scene Unique Node property (Godot 4
%Nodesyntax). -
warning_ignore(name)
Convenience macro to suppress compiler warnings.
- warning_ignore_restore(name)
- warning_ignore_start(name)
Method Detail
C ABI Entry point called by crystal_bridge when game library is loaded
Global convenience helper to load resources from Godot VFS
Global convenience helper to preload resources from Godot VFS
Macro Detail
Top-level await macro for intuitive GDScript-like calling syntax Usage: await(enemy.died) await(enemy.died, timeout_sec: 2.0) await(enemy, "died") await(enemy, "died", timeout_sec: 2.0) await(timer.timeout) await(timer) await(1.5) await(2.seconds)
Categories group top-level inspector sections in Godot.
May be used standalone or as a block scoping exported properties:
export_category "Combat" do
@[Export]
property health : Int32 = 100
end
Groups exported properties in the Godot inspector.
May be used standalone or as a block scoping exported properties:
export_group "Movement", prefix: "move_" do
@[Export]
property move_speed : Float32 = 5.0_f32
end
Subgroups exported properties under the current inspector group.
May be used standalone or as a block scoping exported properties:
export_subgroup "Advanced", prefix: "adv_" do
@[Export]
property adv_friction : Float32 = 0.1_f32
end
Declares a custom RefCounted or generic Godot engine class registered with ClassDB.
Defaults to inheriting RefCounted when no parent is specified.
Can be called with or without a block (e.g. gdclass MyState).
gdclass StateMachine < RefCounted do
@[Export]
property current_state : String = "idle"
end
gdclass SimpleState
Declaratively assigns the node to one or more scene tree groups upon _ready.
node Player < CharacterBody3D do
group "players", "flammable"
end
The primary node macro:
Usage:
node MyNode
node MyNode do
# defaults to Godot::Node
end
node Player < CharacterBody3D node Player < CharacterBody3D do # inherits Godot::CharacterBody3D end
Declares an @onready node property initialized from the scene tree during _ready.
Declares a lazy-cached node property matching Godot's @onready pattern.
Supports:
- Auto-inferred path:
onready sprite_2d, Sprite2D(fetches "Sprite2D") - Scene Unique Node:
onready camera, Camera2D, "%MainCamera" - Explicit path:
onready sprite, Sprite2D, "Visuals/Sprite2D"
Declares a custom Godot Resource class registered with ClassDB and EditorHelp.
Supports @[Export] properties, custom signals, and serialization to .tres.
resource ItemData < Resource do
@[Export]
property item_name : String = "Health Potion"
Declares a custom Resource subclass registered with ClassDB.
Defaults to inheriting `Resource` when no parent is specified.
Can be called with or without a block (e.g. `resource MyItem`).
```crystal
resource CustomPotion do
@[Export]
property item_name : String = "Health Potion"
@[Export]
property value : Int32 = 50
end
resource ShortItem
Declares a custom Godot signal and generates a type-safe emit_<signal_name> helper method.
class Player < Godot::CharacterBody3D
signal health_changed(new_health : Int32, max_health : Int32)
signal died
def take_damage(amount : Int32)
emit_health_changed(50, 100)
emit_died if amount >= 100
end
end
Declares a lazy-cached Scene Unique Node property (Godot 4 %Node syntax).
Examples:
unique_node health_bar, ProgressBar # fetches "%HealthBar"
unique_node main_hud, CanvasLayer, "HUD" # fetches "%HUD"