Add pollEventsWithImGui (#13)

This commit is contained in:
sheaf 2021-01-26 12:23:05 +01:00 committed by GitHub
parent e220775b21
commit e4b75e355f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,7 @@ module DearImGui.SDL (
sdl2NewFrame sdl2NewFrame
, sdl2Shutdown , sdl2Shutdown
, pollEventWithImGui , pollEventWithImGui
, pollEventsWithImGui
) )
where where
@ -81,3 +82,12 @@ pollEventWithImGui = liftIO do
[C.exp| void { ImGui_ImplSDL2_ProcessEvent((SDL_Event*) $(void* evPtr')) } |] [C.exp| void { ImGui_ImplSDL2_ProcessEvent((SDL_Event*) $(void* evPtr')) } |]
pollEvent pollEvent
-- | Like the SDL2 'pollEvents' function, while also dispatching the events to
-- Dear ImGui. See 'pollEventWithImGui'.
pollEventsWithImGui :: MonadIO m => m [Event]
pollEventsWithImGui = do
e <- pollEventWithImGui
case e of
Nothing -> pure []
Just e' -> ( e' : ) <$> pollEventsWithImGui