Skip to content

Commit bab4d76

Browse files
authored
V2.2.0 (#189)
* Upgrade upstream and prepare 2.2.0 * Update vulkan example
1 parent eec8b57 commit bab4d76

File tree

4 files changed

+40
-35
lines changed

4 files changed

+40
-35
lines changed

ChangeLog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog for dear-imgui
22

3+
## [2.2.0]
4+
5+
- `imgui` updated to [1.89.9].
6+
- Update bounds for ghc-9.6.
7+
- Exposed `DearImGui.Raw.Context`.
8+
- Added `getCursorPos``.
9+
- Fix TabItem flags type.
10+
311
## [2.1.3]
412

513
- Fixed off-by-1 in internal Text wrapper.
@@ -107,7 +115,9 @@ Initial Hackage release based on [1.83].
107115
[2.1.1]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.1
108116
[2.1.2]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.2
109117
[2.1.3]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.3
118+
[2.2.0]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.2.0
110119

120+
[1.89.9]: https://github.com/ocornut/imgui/releases/tag/v1.89.9
111121
[1.87]: https://github.com/ocornut/imgui/releases/tag/v1.87
112122
[1.86]: https://github.com/ocornut/imgui/releases/tag/v1.86
113123
[1.85]: https://github.com/ocornut/imgui/releases/tag/v1.85

dear-imgui.cabal

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cabal-version: 3.0
22

33
name: dear-imgui
4-
version: 2.1.3
4+
version: 2.2.0
55
author: Oliver Charles
66
77
license: BSD-3-Clause
@@ -370,25 +370,25 @@ executable vulkan
370370
build-depends:
371371
dear-imgui
372372
, bytestring
373-
>= 0.10.10.0 && < 0.12
373+
>= 0.10.10.0 && < 0.13
374374
, containers
375-
^>= 0.6.2.1
375+
>= 0.6.2.1 && < 0.7
376376
, logging-effect
377-
^>= 1.3.12
377+
>= 1.3.12 && < 1.5
378378
, resourcet
379-
^>= 1.2.4.2
379+
>= 1.2.4.2 && < 1.3
380380
, sdl2
381-
^>= 2.5.3.0
382-
, text-short
383-
^>= 0.1.3
381+
>= 2.5.3.0 && < 2.6
382+
, text
383+
>= 1.2.4 && < 2.1
384384
, transformers
385385
>= 0.5.6 && < 0.7
386386
, unliftio
387-
>= 0.2.13 && < 0.2.19
387+
>= 0.2.13 && < 0.3
388388
, unliftio-core
389-
^>= 0.2.0.1
389+
>= 0.2.0.1 && < 0.3
390390
, vector
391-
^>= 0.12.1.2
391+
>= 0.12.1.2 && < 0.14
392392
, vulkan
393393
>= 3.12
394394
, vulkan-utils

examples/vulkan/Backend.hs

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import Data.Traversable
4444
import Data.Word
4545
( Word32 )
4646
import Foreign.C.String
47-
( CString )
47+
( peekCString )
4848
import Foreign.C.Types
4949
( CInt )
5050
import Foreign.Ptr
@@ -53,8 +53,6 @@ import Foreign.Ptr
5353
-- bytestring
5454
import Data.ByteString
5555
( ByteString )
56-
import qualified Data.ByteString.Short as ShortByteString
57-
( packCString )
5856

5957
-- containers
6058
import qualified Data.Map.Strict as Map
@@ -77,11 +75,13 @@ import qualified SDL
7775
import qualified SDL.Raw
7876
import qualified SDL.Video.Vulkan
7977

80-
-- text-short
81-
import Data.Text.Short
82-
( ShortText )
83-
import qualified Data.Text.Short as ShortText
84-
( intercalate, pack, fromShortByteString, toByteString, unpack )
78+
-- text
79+
import Data.Text
80+
( Text )
81+
import qualified Data.Text as Text
82+
( intercalate, pack, unpack )
83+
import Data.Text.Encoding
84+
( encodeUtf8 )
8585

8686
-- transformers
8787
import Control.Monad.IO.Class
@@ -118,7 +118,7 @@ import Attachments
118118

119119
--------------------------------------------------------------------------------
120120

121-
type LogMessage = WithSeverity ShortText
121+
type LogMessage = WithSeverity Text
122122
class ( MonadUnliftIO m, MonadResource m, MonadLog LogMessage m ) => MonadVulkan m
123123
instance ( MonadUnliftIO m, MonadResource m, MonadLog LogMessage m ) => MonadVulkan m
124124

@@ -127,9 +127,9 @@ instance ( MonadUnliftIO m, MonadResource m, MonadLog LogMessage m ) => MonadVul
127127

128128
logHandler :: MonadIO m => LogMessage -> m ()
129129
logHandler ( WithSeverity sev mess )
130-
= liftIO . putStrLn . ShortText.unpack $ showSeverity sev <> " " <> mess
130+
= liftIO . putStrLn . Text.unpack $ showSeverity sev <> " " <> mess
131131

132-
showSeverity :: Severity -> ShortText
132+
showSeverity :: Severity -> Text
133133
showSeverity Emergency = "! PANIC !"
134134
showSeverity Alert = "! ALERT !"
135135
showSeverity Critical = "! CRIT !"
@@ -244,7 +244,7 @@ vulkanInstanceInfo appName = do
244244

245245
case validationLayer of
246246
Nothing -> logInfo "Validation layer unavailable. Is the Vulkan SDK installed?"
247-
Just _ -> logInfo ( "Enabled validation layers " <> ShortText.pack ( show enabledLayers ) )
247+
Just _ -> logInfo ( "Enabled validation layers " <> Text.pack ( show enabledLayers ) )
248248

249249
pure createInfo
250250

@@ -305,26 +305,23 @@ initialiseWindow ( WindowInfo { height, width, windowName, mouseMode } ) = do
305305
void ( SDL.setMouseLocationMode mouseMode )
306306
window <- logDebug "Creating SDL window" *> createWindow width height windowName
307307
neededExtensions <- logDebug "Loading needed extensions" *> SDL.Video.Vulkan.vkGetInstanceExtensions window
308-
extensionNames <- traverse ( liftIO . peekCString ) neededExtensions
309-
logInfo $ "Needed instance extensions are: " <> ShortText.intercalate ", " extensionNames
310-
pure ( window, map ShortText.toByteString extensionNames )
311-
312-
peekCString :: CString -> IO ShortText
313-
peekCString = fmap ( fromMaybe "???" . ShortText.fromShortByteString ) . ShortByteString.packCString
308+
extensionNames <- traverse ( liftIO . fmap fromString . peekCString ) neededExtensions
309+
logInfo $ "Needed instance extensions are: " <> Text.intercalate ", " extensionNames
310+
pure ( window, map encodeUtf8 extensionNames )
314311

315312
data WindowInfo
316313
= WindowInfo
317314
{ width :: CInt
318315
, height :: CInt
319-
, windowName :: ShortText
316+
, windowName :: Text
320317
, mouseMode :: SDL.LocationMode
321318
}
322319

323-
createWindow :: MonadVulkan m => CInt -> CInt -> ShortText -> m SDL.Window
320+
createWindow :: MonadVulkan m => CInt -> CInt -> Text -> m SDL.Window
324321
createWindow x y title =
325322
snd <$> ResourceT.allocate
326323
( SDL.createWindow
327-
( fromString ( ShortText.unpack title ) )
324+
( fromString ( Text.unpack title ) )
328325
SDL.defaultWindow
329326
{ SDL.windowGraphicsContext = SDL.VulkanContext
330327
, SDL.windowInitialSize = SDL.V2 x y
@@ -404,8 +401,6 @@ createSwapchain physicalDevice device surface surfaceFormat imageUsage imageCoun
404401

405402
surfaceCapabilities <- Vulkan.getPhysicalDeviceSurfaceCapabilitiesKHR physicalDevice ( Vulkan.SurfaceKHR surface )
406403

407-
( _, presentModes ) <- Vulkan.getPhysicalDeviceSurfacePresentModesKHR physicalDevice ( Vulkan.SurfaceKHR surface )
408-
409404
let
410405
presentMode :: Vulkan.PresentModeKHR
411406
presentMode =

imgui

Submodule imgui updated 61 files

0 commit comments

Comments
 (0)