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) #

[View source]

Instance Method Detail

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

[View source]
def capacity : Int32 #

[View source]
def channel : Godot::Channel #

[View source]
def close : Void #

[View source]
def closed? : Bool #

[View source]
def destroy : Void #

[View source]
def empty? : Bool #

[View source]
def full? : Bool #

[View source]
def receive(timeout_sec : Float64 | Nil = nil) : T | Nil #

[View source]
def send(val : T) : Bool #

[View source]
def size : Int32 #

[View source]
def try_receive : T | Nil #

[View source]
def try_send(val : T) : Bool #

[View source]