Return Bool when appropriate (#11)

I also updated the main functions to use (/=0) instead of (==1).
This commit is contained in:
sheaf
2021-01-26 12:35:09 +01:00
committed by GitHub
parent e4b75e355f
commit d227561885
3 changed files with 21 additions and 21 deletions

View File

@ -42,9 +42,9 @@ Cpp.using "namespace ImGui"
-- | Wraps @ImGui_ImplOpenGL2_Init@.
openGL2Init :: MonadIO m => m ()
openGL2Init :: MonadIO m => m Bool
openGL2Init = liftIO do
[C.exp| void { ImGui_ImplOpenGL2_Init(); } |]
( 0 /= ) <$> [C.exp| bool { ImGui_ImplOpenGL2_Init() } |]
-- | Wraps @ImGui_ImplOpenGL2_Shutdown@.

View File

@ -49,9 +49,9 @@ Cpp.using "namespace ImGui"
-- | Wraps @ImGui_ImplSDL2_InitForOpenGL@.
sdl2InitForOpenGL :: MonadIO m => Window -> GLContext -> m ()
sdl2InitForOpenGL :: MonadIO m => Window -> GLContext -> m Bool
sdl2InitForOpenGL (Window windowPtr) glContext = liftIO do
[C.exp| void { ImGui_ImplSDL2_InitForOpenGL((SDL_Window*)$(void* windowPtr), $(void* glContextPtr)); } |]
( 0 /= ) <$> [C.exp| bool { ImGui_ImplSDL2_InitForOpenGL((SDL_Window*)$(void* windowPtr), $(void* glContextPtr)) } |]
where
glContextPtr :: Ptr ()
glContextPtr = unsafeCoerce glContext