Add wchar32 and disable-obsolete flags (#127)

This commit is contained in:
Alexander Bondarenko 2022-02-13 19:05:49 +03:00 committed by GitHub
parent af6ba9e989
commit ccdff36774
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 10 deletions

View File

@ -24,7 +24,7 @@ extra-source-files:
imgui/imconfig.h, imgui/imconfig.h,
imgui/LICENSE.txt imgui/LICENSE.txt
common build-flags common exe-flags
if flag(debug) if flag(debug)
if os(linux) if os(linux)
ghc-options: -Wall -g -rtsopts -dcore-lint -debug ghc-options: -Wall -g -rtsopts -dcore-lint -debug
@ -50,7 +50,6 @@ common build-flags
ghc-options: -Wall -O2 ghc-options: -Wall -O2
cc-options: -O2 cc-options: -O2
source-repository head source-repository head
type: git type: git
location: https://github.com/haskell-game/dear-imgui.hs location: https://github.com/haskell-game/dear-imgui.hs
@ -111,6 +110,22 @@ flag examples
manual: manual:
True True
flag disable-obsolete
description:
Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names.
default:
False
manual:
True
flag use-wchar32
description:
Use 32-bit for ImWchar (default is 16-bit) to support unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...)
default:
True
manual:
True
common common common common
build-depends: build-depends:
base base
@ -157,6 +172,13 @@ library
, unliftio , unliftio
, vector , vector
if flag(disable-obsolete)
cxx-options: -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS
if flag(use-wchar32)
cxx-options: -DIMGUI_USE_WCHAR32
cpp-options: -DIMGUI_USE_WCHAR32
if flag(opengl2) if flag(opengl2)
exposed-modules: exposed-modules:
DearImGui.OpenGL2 DearImGui.OpenGL2
@ -273,7 +295,7 @@ library dear-imgui-generator
>= 0.2.11 && < 0.3 >= 0.2.11 && < 0.3
executable test executable test
import: common, build-flags import: common, exe-flags
main-is: Main.hs main-is: Main.hs
default-language: Haskell2010 default-language: Haskell2010
if (!flag(examples) || !flag(sdl) || !flag(opengl2)) if (!flag(examples) || !flag(sdl) || !flag(opengl2))
@ -282,7 +304,7 @@ executable test
build-depends: base, sdl2, gl, dear-imgui, vector build-depends: base, sdl2, gl, dear-imgui, vector
executable glfw executable glfw
import: common, build-flags import: common, exe-flags
main-is: Main.hs main-is: Main.hs
hs-source-dirs: examples/glfw hs-source-dirs: examples/glfw
default-language: Haskell2010 default-language: Haskell2010
@ -292,7 +314,7 @@ executable glfw
build-depends: base, GLFW-b, gl, dear-imgui, managed build-depends: base, GLFW-b, gl, dear-imgui, managed
executable readme executable readme
import: common, build-flags import: common, exe-flags
main-is: Readme.hs main-is: Readme.hs
hs-source-dirs: examples hs-source-dirs: examples
build-depends: sdl2, gl, dear-imgui, managed build-depends: sdl2, gl, dear-imgui, managed
@ -300,7 +322,7 @@ executable readme
buildable: False buildable: False
executable fonts executable fonts
import: common, build-flags import: common, exe-flags
main-is: Main.hs main-is: Main.hs
hs-source-dirs: examples/fonts hs-source-dirs: examples/fonts
build-depends: sdl2, gl, dear-imgui, managed build-depends: sdl2, gl, dear-imgui, managed
@ -308,7 +330,7 @@ executable fonts
buildable: False buildable: False
executable image executable image
import: common, build-flags import: common, exe-flags
main-is: Image.hs main-is: Image.hs
hs-source-dirs: examples/sdl hs-source-dirs: examples/sdl
build-depends: sdl2, gl, dear-imgui, managed, vector build-depends: sdl2, gl, dear-imgui, managed, vector
@ -316,7 +338,7 @@ executable image
buildable: False buildable: False
executable vulkan executable vulkan
import: common, build-flags import: common, exe-flags
main-is: Main.hs main-is: Main.hs
other-modules: Attachments, Backend, Input, Util other-modules: Attachments, Backend, Input, Util
hs-source-dirs: examples/vulkan hs-source-dirs: examples/vulkan

View File

@ -1,11 +1,17 @@
{-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE CPP #-}
module DearImGui.Structs where module DearImGui.Structs where
-- base -- base
import Data.Word import Data.Word
( Word32, Word16 ) ( Word32
#ifndef IMGUI_USE_WCHAR32
, Word16
#endif
)
import Foreign import Foreign
( Storable(..), castPtr, plusPtr ) ( Storable(..), castPtr, plusPtr )
@ -96,5 +102,8 @@ data ImGuiListClipper
type ImU32 = Word32 type ImU32 = Word32
-- | Single wide character (used mostly in glyph management) -- | Single wide character (used mostly in glyph management)
#ifdef IMGUI_USE_WCHAR32
type ImWchar = Word32
#else
type ImWchar = Word16 type ImWchar = Word16
-- FIXME: consider IMGUI_USE_WCHAR32 #endif