Sending Events with EventWriter<T>
Example sending events that are defined in the engine:
ts
import { type EventWriter, Events } from '@vaguevoid/fiasco';
function system(writer: EventWriter<Events.Input.KeyboardInput>) {
writer.send(new Events.Input.KeyboardInputT(Events.Input.KeyCode.ArrowLeft))
}
WARNING
When defining an EventWriter with a flatbuffer type, the .send()
method will enforce the use of the T
variant of the type. So instead of sending a KeyboardInput
, you will be forced to send a KeyboardInputT
which should be generated by flatbuffer when using the --object-api
flag.