Schedulers
Overview
QfStudio.Godette.ReactiveUI provides three schedulers that bridge Godot's frame loop to the Rx scheduling model:
| Scheduler | Alias | Source | Purpose |
|---|---|---|---|
GodotMainThreadScheduler | RxSchedulers.MainThreadScheduler | SynchronizationContext | Main thread callbacks |
GodotSchedulers.ProcessFrameScheduler | — | _Process | Per-frame scheduling |
GodotSchedulers.PhysicsFrameScheduler | — | _PhysicsProcess | Physics frame scheduling |
Initialization in Autoload
Create the two frame schedulers as fields and pass them to WithGodot in RxAppBootstrapper -- it creates the main-thread scheduler from SynchronizationContext.Current and exposes all three schedulers through GodotSchedulers:
private readonly GodotFrameScheduler _processFrameScheduler = new();
private readonly GodotFrameScheduler _physicsFrameScheduler = new();
RxAppBuilder.CreateReactiveUIBuilder()
.WithGodot(_processFrameScheduler, _physicsFrameScheduler)
// .WithGodotConverters() // optional
// .WithGodotViewLocator(...) // optional
.BuildApp();RxAppBuilder.BuildApp() mirrors the scheduler registered via .WithMainThreadScheduler(...) (inside WithGodot) to RxSchedulers.MainThreadScheduler, so ObserveOn(RxSchedulers.MainThreadScheduler) resolves to the same GodotMainThreadScheduler.
Frame Driving
public override void _Process(double delta)
{
_processFrameScheduler.NotifyProcess(delta);
}
public override void _PhysicsProcess(double delta)
{
_physicsFrameScheduler.NotifyProcess(delta);
}Calling NotifyProcess each frame drives the frame scheduler to execute queued operations. GodotSchedulers is the Godot-side alias for the same instances, used by frame operators and other Godot-specific APIs.