{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
module DearImGui.OpenGL2
( openGL2Init
, openGL2Shutdown
, openGL2NewFrame
, openGL2RenderDrawData
)
where
import qualified Language.C.Inline as C
import qualified Language.C.Inline.Cpp as Cpp
import Control.Monad.IO.Class
( MonadIO, liftIO )
import DearImGui
( DrawData(..) )
C.context (Cpp.cppCtx <> C.bsCtx)
C.include "imgui.h"
C.include "backends/imgui_impl_opengl2.h"
Cpp.using "namespace ImGui"
openGL2Init :: MonadIO m => m Bool
openGL2Init :: forall (m :: * -> *). MonadIO m => m Bool
openGL2Init = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
( CBool
0 CBool -> CBool -> Bool
forall a. Eq a => a -> a -> Bool
/= ) (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> IO CBool
[C.exp| bool { ImGui_ImplOpenGL2_Init() } |]
openGL2Shutdown :: MonadIO m => m ()
openGL2Shutdown :: forall (m :: * -> *). MonadIO m => m ()
openGL2Shutdown = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
IO ()
[C.exp| void { ImGui_ImplOpenGL2_Shutdown(); } |]
openGL2NewFrame :: MonadIO m => m ()
openGL2NewFrame :: forall (m :: * -> *). MonadIO m => m ()
openGL2NewFrame = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
IO ()
[C.exp| void { ImGui_ImplOpenGL2_NewFrame(); } |]
openGL2RenderDrawData :: MonadIO m => DrawData -> m ()
openGL2RenderDrawData :: forall (m :: * -> *). MonadIO m => DrawData -> m ()
openGL2RenderDrawData (DrawData Ptr ()
ptr) = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[C.exp| void { ImGui_ImplOpenGL2_RenderDrawData((ImDrawData*) $( void* ptr )) } |]