Skip to content

Commit

Permalink
lifted to imgui 1.89.7 & implot master (1.89.7 fixes)
Browse files Browse the repository at this point in the history
  • Loading branch information
Drezil committed Jul 17, 2023
1 parent da2b394 commit 2998707
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
branch = v0.13
[submodule "dear-imgui.hs"]
path = dear-imgui.hs
url = https://github.com/drezil/dear-imgui.hs
url = https://github.com/haskell-game/dear-imgui.hs
6 changes: 3 additions & 3 deletions dear-implot.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ library
DearImGui.Generator.Types
DearImGui.Structs
DearImGui.Enums
DearImGui.Context
DearImGui.Raw.Context
hs-source-dirs:
src
default-language:
Expand All @@ -65,7 +65,7 @@ library
implot/implot_demo.cpp
implot/implot_items.cpp
cxx-options:
-std=c++11
-std=c++11 -DIMGUI_DEFINE_MATH_OPERATORS
extra-libraries:
stdc++
include-dirs:
Expand All @@ -83,7 +83,7 @@ library
build-depends: base
, StateVar
, containers
, dear-imgui == 2.1.0
, dear-imgui == 2.1.3
, inline-c
, inline-c-cpp
, managed
Expand Down
2 changes: 1 addition & 1 deletion implot
1 change: 0 additions & 1 deletion src/DearImGui/Context.hs

This file was deleted.

6 changes: 4 additions & 2 deletions src/DearImGui/Plot/Generator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import Data.Traversable
( for )
import Foreign.Storable
( Storable )
import Data.Coerce
( coerce )

-- containers
import Data.Map.Strict
Expand Down Expand Up @@ -165,15 +167,15 @@ declareEnumeration finiteEnumName countName ( Enumeration {..} ) = do
pure ( finiteEnumInst : )
else pure id

synonyms <- for patterns \ ( patternName, patternValue, CommentText _patDoc ) -> do
synonyms <- for patterns \ ( patternName, patternValue, CommentText patDoc ) -> do
let
patNameStr :: String
patNameStr = Text.unpack patternName
patName <- TH.newName patNameStr
patSynSig <- TH.patSynSigD patName ( TH.conT tyName )
pat <-
#if MIN_VERSION_template_haskell(2,18,0)
( if Text.null _patDoc
( if Text.null patDoc
then TH.patSynD
else
\ nm args dir pat ->
Expand Down
6 changes: 4 additions & 2 deletions src/DearImGui/Plot/Generator/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ plotHeaders = do
manyTill
( ( Left <$> try ignoreDefine)
<|> ( Right <$> enumeration enumNamesAndTypes)
<|> ( Left <$> ignoreStruct)
<|> ( Left <$> try ignoreStruct)
<|> ( Left <$> cppConditionalIgnore)
)
( namedSection "Callbacks" )
Expand Down Expand Up @@ -210,7 +210,7 @@ enumeration enumNamesAndTypes = do
enumTypeName = ()
( underlyingType, forwardDoc ) <- case HashMap.lookup enumName enumNamesAndTypes of
Just res -> pure res
Nothing -> customFailure ( MissingForwardDeclaration { enumName } )
Nothing -> customFailure ( MissingForwardDeclaration { enumName, library = enumNamesAndTypes } )
let
docs :: [Comment]
docs = forwardDoc : CommentText "" : inlineDocs
Expand Down Expand Up @@ -438,13 +438,15 @@ cppDirective f = token ( \case { BeginCPP a -> f a; _ -> Nothing } ) mempty

cppConditional :: MonadParsec e [Tok] m => m ()
cppConditional = do
void $ many comment
void $ cppDirective ( \case { "ifdef" -> Just True; "ifndef" -> Just False; _ -> Nothing } )
-- assumes no nesting
void $ skipManyTill anySingle ( cppDirective ( \case { "endif" -> Just (); _ -> Nothing } ) )
void $ skipManyTill anySingle ( single EndCPPLine )

cppConditionalIgnore :: MonadParsec e [Tok] m => m ()
cppConditionalIgnore = do
void $ many comment
void $ cppDirective ( \case { "ifdef" -> Just (); "ifndef" -> Just (); "if" -> Just (); _ -> Nothing } )
-- assumes no nesting
void $ skipManyTill anySingle ( cppDirective ( \case { "endif" -> Just (); _ -> Nothing } ) )
Expand Down
1 change: 1 addition & 0 deletions src/DearImGui/Raw/Context.hs
2 changes: 1 addition & 1 deletion src/DearImGui/Raw/Plot.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import System.IO.Unsafe

-- dear-imgui
import DearImGui
import DearImGui.Context
import DearImGui.Raw.Context
import DearImGui.Plot.Context
( implotContext )
import DearImGui.Plot.Enums
Expand Down

0 comments on commit 2998707

Please sign in to comment.