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/LICENSE.txt
common build-flags
common exe-flags
if flag(debug)
if os(linux)
ghc-options: -Wall -g -rtsopts -dcore-lint -debug
@ -50,7 +50,6 @@ common build-flags
ghc-options: -Wall -O2
cc-options: -O2
source-repository head
type: git
location: https://github.com/haskell-game/dear-imgui.hs
@ -111,6 +110,22 @@ flag examples
manual:
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
build-depends:
base
@ -157,6 +172,13 @@ library
, unliftio
, 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)
exposed-modules:
DearImGui.OpenGL2
@ -273,7 +295,7 @@ library dear-imgui-generator
>= 0.2.11 && < 0.3
executable test
import: common, build-flags
import: common, exe-flags
main-is: Main.hs
default-language: Haskell2010
if (!flag(examples) || !flag(sdl) || !flag(opengl2))
@ -282,7 +304,7 @@ executable test
build-depends: base, sdl2, gl, dear-imgui, vector
executable glfw
import: common, build-flags
import: common, exe-flags
main-is: Main.hs
hs-source-dirs: examples/glfw
default-language: Haskell2010
@ -292,7 +314,7 @@ executable glfw
build-depends: base, GLFW-b, gl, dear-imgui, managed
executable readme
import: common, build-flags
import: common, exe-flags
main-is: Readme.hs
hs-source-dirs: examples
build-depends: sdl2, gl, dear-imgui, managed
@ -300,7 +322,7 @@ executable readme
buildable: False
executable fonts
import: common, build-flags
import: common, exe-flags
main-is: Main.hs
hs-source-dirs: examples/fonts
build-depends: sdl2, gl, dear-imgui, managed
@ -308,7 +330,7 @@ executable fonts
buildable: False
executable image
import: common, build-flags
import: common, exe-flags
main-is: Image.hs
hs-source-dirs: examples/sdl
build-depends: sdl2, gl, dear-imgui, managed, vector
@ -316,7 +338,7 @@ executable image
buildable: False
executable vulkan
import: common, build-flags
import: common, exe-flags
main-is: Main.hs
other-modules: Attachments, Backend, Input, Util
hs-source-dirs: examples/vulkan

View File

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