{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ViewPatterns #-}
module DearImGui.Raw.Font.Config
( FontConfig(..)
, new
, destroy
, setFontDataOwnedByAtlas
, setFontNo
, setSizePixels
, setOversampleH
, setOversampleV
, setPixelSnapH
, setGlyphExtraSpacing
, setGlyphOffset
, setGlyphRanges
, setGlyphMinAdvanceX
, setGlyphMaxAdvanceX
, setMergeMode
, setFontBuilderFlags
, setRasterizerMultiply
, setEllipsisChar
)
where
import Control.Monad.IO.Class
( MonadIO, liftIO )
import Foreign ( Ptr )
import Foreign.C
import DearImGui.Raw.Context
( imguiContext )
import DearImGui.Structs
import DearImGui.Raw.Font.GlyphRanges
( GlyphRanges(..) )
import qualified Language.C.Inline as C
import qualified Language.C.Inline.Cpp as Cpp
C.context (Cpp.cppCtx <> C.bsCtx <> imguiContext)
C.include "imgui.h"
Cpp.using "namespace ImGui"
newtype FontConfig = FontConfig (Ptr ImFontConfig)
new :: MonadIO m => m FontConfig
new :: forall (m :: * -> *). MonadIO m => m FontConfig
new = IO FontConfig -> m FontConfig
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Ptr ImFontConfig -> FontConfig
FontConfig (Ptr ImFontConfig -> FontConfig)
-> IO (Ptr ImFontConfig) -> IO FontConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> IO (Ptr ImFontConfig)
[C.block|
ImFontConfig* {
return IM_NEW(ImFontConfig);
}
|]
destroy :: MonadIO m => FontConfig -> m ()
destroy :: forall (m :: * -> *). MonadIO m => FontConfig -> m ()
destroy (FontConfig Ptr ImFontConfig
config) = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[C.block|
void {
IM_DELETE($(ImFontConfig* config));
}
|]
setFontDataOwnedByAtlas :: MonadIO m => FontConfig -> CBool -> m ()
setFontDataOwnedByAtlas :: forall (m :: * -> *). MonadIO m => FontConfig -> CBool -> m ()
setFontDataOwnedByAtlas (FontConfig Ptr ImFontConfig
fc) CBool
value = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[C.block|
void {
$(ImFontConfig* fc)->FontDataOwnedByAtlas = $(bool value);
}
|]
setFontNo :: MonadIO m => FontConfig -> CInt -> m ()
setFontNo :: forall (m :: * -> *). MonadIO m => FontConfig -> CInt -> m ()
setFontNo (FontConfig Ptr ImFontConfig
fc) CInt
value = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[C.block|
void {
$(ImFontConfig* fc)->FontNo = $(int value);
}
|]
setSizePixels :: MonadIO m => FontConfig -> CFloat -> m ()
setSizePixels :: forall (m :: * -> *). MonadIO m => FontConfig -> CFloat -> m ()
setSizePixels (FontConfig Ptr ImFontConfig
fc) CFloat
value = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[C.block|
void {
$(ImFontConfig* fc)->SizePixels = $(float value);
}
|]
setOversampleH :: MonadIO m => FontConfig -> CInt -> m ()
setOversampleH :: forall (m :: * -> *). MonadIO m => FontConfig -> CInt -> m ()
setOversampleH (FontConfig Ptr ImFontConfig
fc) CInt
value = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[C.block|
void {
$(ImFontConfig* fc)->OversampleH = $(int value);
}
|]
setOversampleV :: MonadIO m => FontConfig -> CInt -> m ()
setOversampleV :: forall (m :: * -> *). MonadIO m => FontConfig -> CInt -> m ()
setOversampleV (FontConfig Ptr ImFontConfig
fc) CInt
value = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[C.block|
void {
$(ImFontConfig* fc)->OversampleV = $(int value);
}
|]
setPixelSnapH :: MonadIO m => FontConfig -> CBool -> m ()
setPixelSnapH :: forall (m :: * -> *). MonadIO m => FontConfig -> CBool -> m ()
setPixelSnapH (FontConfig Ptr ImFontConfig
fc) CBool
value = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[C.block|
void {
$(ImFontConfig* fc)->PixelSnapH = $(bool value);
}
|]
setGlyphExtraSpacing :: MonadIO m => FontConfig -> Ptr ImVec2 -> m ()
(FontConfig Ptr ImFontConfig
fc) Ptr ImVec2
value = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[C.block|
void {
$(ImFontConfig* fc)->GlyphExtraSpacing = *$(ImVec2* value);
}
|]
setGlyphOffset :: MonadIO m => FontConfig -> Ptr ImVec2 -> m ()
setGlyphOffset :: forall (m :: * -> *). MonadIO m => FontConfig -> Ptr ImVec2 -> m ()
setGlyphOffset (FontConfig Ptr ImFontConfig
fc) Ptr ImVec2
value = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[C.block|
void {
$(ImFontConfig* fc)->GlyphOffset = *$(ImVec2* value);
}
|]
setGlyphRanges :: MonadIO m => FontConfig -> GlyphRanges -> m ()
setGlyphRanges :: forall (m :: * -> *).
MonadIO m =>
FontConfig -> GlyphRanges -> m ()
setGlyphRanges (FontConfig Ptr ImFontConfig
fc) (GlyphRanges Ptr ImWchar
value) = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[C.block|
void {
$(ImFontConfig* fc)->GlyphRanges = $(ImWchar* value);
}
|]
setGlyphMinAdvanceX :: MonadIO m => FontConfig -> CFloat -> m ()
setGlyphMinAdvanceX :: forall (m :: * -> *). MonadIO m => FontConfig -> CFloat -> m ()
setGlyphMinAdvanceX (FontConfig Ptr ImFontConfig
fc) CFloat
value = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[C.block|
void {
$(ImFontConfig* fc)->GlyphMinAdvanceX = $(float value);
}
|]
setGlyphMaxAdvanceX :: MonadIO m => FontConfig -> CFloat -> m ()
setGlyphMaxAdvanceX :: forall (m :: * -> *). MonadIO m => FontConfig -> CFloat -> m ()
setGlyphMaxAdvanceX (FontConfig Ptr ImFontConfig
fc) CFloat
value = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[C.block|
void {
$(ImFontConfig* fc)->GlyphMaxAdvanceX = $(float value);
}
|]
setMergeMode :: MonadIO m => FontConfig -> CBool -> m ()
setMergeMode :: forall (m :: * -> *). MonadIO m => FontConfig -> CBool -> m ()
setMergeMode (FontConfig Ptr ImFontConfig
fc) CBool
value = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[C.block|
void {
$(ImFontConfig* fc)->MergeMode = $(bool value);
}
|]
setFontBuilderFlags :: MonadIO m => FontConfig -> CUInt -> m ()
setFontBuilderFlags :: forall (m :: * -> *). MonadIO m => FontConfig -> CUInt -> m ()
setFontBuilderFlags (FontConfig Ptr ImFontConfig
fc) CUInt
value = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[C.block|
void {
$(ImFontConfig* fc)->FontBuilderFlags = $(unsigned int value);
}
|]
setRasterizerMultiply :: MonadIO m => FontConfig -> CFloat -> m ()
setRasterizerMultiply :: forall (m :: * -> *). MonadIO m => FontConfig -> CFloat -> m ()
setRasterizerMultiply (FontConfig Ptr ImFontConfig
fc) CFloat
value = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[C.block|
void {
$(ImFontConfig* fc)->RasterizerMultiply = $(float value);
}
|]
setEllipsisChar :: MonadIO m => FontConfig -> ImWchar -> m ()
setEllipsisChar :: forall (m :: * -> *). MonadIO m => FontConfig -> ImWchar -> m ()
setEllipsisChar (FontConfig Ptr ImFontConfig
fc) ImWchar
value = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[C.block|
void {
$(ImFontConfig* fc)->EllipsisChar = $(ImWchar value);
}
|]