class Godot::TypedChannel(T)

Overview

Strongly-typed generic wrapper around Godot::Channel for type-safe Crystal gameplay code.

channel = Godot::TypedChannel(Godot::Vector3).new(16)
channel.send(Godot::Vector3.new(1.0, 2.0, 3.0))

spawn do
  if pos = channel.await_receive
    player.position = pos
  end
end

Defined in:

libgodot/channel.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(capacity : Int32 = 16) #

Instance Method Detail

def await_receive(timeout_sec : Float64 | Nil = nil) : T | Nil #

def capacity : Int32 #

def channel : Godot::Channel #

def close : Void #

def closed? : Bool #

def destroy : Void #

def drain(&block : T -> Void) : Int32 #

def drain_all : Array(T) #

def empty? : Bool #

def full? : Bool #

def is_closed : Bool #

def is_empty : Bool #

def is_full : Bool #

def receive(timeout_sec : Float64 | Nil = nil) : T | Nil #

def send(val : T) : Bool #

def size : Int32 #

def try_receive : T | Nil #

def try_send(val : T) : Bool #