keid-frp-banana-0.1.2.0: Reactive Banana integration for Keid engine.
Safe HaskellSafe-Inferred
LanguageGHC2021

Engine.ReactiveBanana.Window

Synopsis

Wrapped Engine.Window.* callbacks

allocateCursorPos :: ResourceT (StageRIO st) (MomentIO (Event (Double, Double))) Source #

Set up a window callback to fire window CursorPos events.

allocateDrop :: ResourceT (StageRIO st) (MomentIO (Event [FilePath])) Source #

Set up a window callback to fire window Drop events.

allocateMouseButton :: ResourceT (StageRIO st) (MomentIO (Event (ModifierKeys, MouseButtonState, MouseButton))) Source #

Set up a window callback to fire window MouseButton events.

To prevent clicks when hovering over some ImGui window wrap in a whenE filter:

imguiCaptureMouse <- RBF.fromPoll ImGui.wantCaptureMouse
mouseButtonE <- fmap (RB.whenE $ fmap not imguiCaptureMouse) fromMouseButton

allocateScroll :: ResourceT (StageRIO st) (MomentIO (Event (Double, Double))) Source #

Set up a window callback to fire window Scroll events.

allocateKey :: ResourceT (StageRIO st) (MomentIO (Event (Int, (ModifierKeys, KeyState, Key)))) Source #

Set up a window callback to fire window Key events.

To prevent clicks when ImGui is busy with text input wrap in a whenE filter:

imguiCaptureKeyboard <- RBF.fromPoll ImGui.wantCaptureKeyboard
keyE <- fmap (RB.whenE $ fmap not imguiCaptureKeyboard) fromKey

Layout helpers

setupScreenBox :: (forall a. StageRIO env a -> MomentIO a) -> MomentIO (Behavior Box) Source #

Screen-sized layout base.

setupCursorPos :: MonadMoment m => m (Event (Double, Double)) -> Behavior Box -> m (Event Vec2, Behavior Vec2) Source #

Project window cursor position to layout.

setupMouseClicks :: MomentIO (Event (ModifierKeys, MouseButtonState, MouseButton)) -> Behavior cursor -> MomentIO (Collection (Event (ModifierKeys, cursor))) Source #

Set up a per-button collection of fused (position, modifier) click ("button pressed") events.