mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2024-11-22 08:56:59 +00:00
V2.2.0 (#189)
* Upgrade upstream and prepare 2.2.0 * Update vulkan example
This commit is contained in:
parent
eec8b57ce8
commit
bab4d769ea
10
ChangeLog.md
10
ChangeLog.md
@ -1,5 +1,13 @@
|
|||||||
# Changelog for dear-imgui
|
# Changelog for dear-imgui
|
||||||
|
|
||||||
|
## [2.2.0]
|
||||||
|
|
||||||
|
- `imgui` updated to [1.89.9].
|
||||||
|
- Update bounds for ghc-9.6.
|
||||||
|
- Exposed `DearImGui.Raw.Context`.
|
||||||
|
- Added `getCursorPos``.
|
||||||
|
- Fix TabItem flags type.
|
||||||
|
|
||||||
## [2.1.3]
|
## [2.1.3]
|
||||||
|
|
||||||
- Fixed off-by-1 in internal Text wrapper.
|
- Fixed off-by-1 in internal Text wrapper.
|
||||||
@ -107,7 +115,9 @@ Initial Hackage release based on [1.83].
|
|||||||
[2.1.1]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.1
|
[2.1.1]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.1
|
||||||
[2.1.2]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.2
|
[2.1.2]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.2
|
||||||
[2.1.3]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.3
|
[2.1.3]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.3
|
||||||
|
[2.2.0]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.2.0
|
||||||
|
|
||||||
|
[1.89.9]: https://github.com/ocornut/imgui/releases/tag/v1.89.9
|
||||||
[1.87]: https://github.com/ocornut/imgui/releases/tag/v1.87
|
[1.87]: https://github.com/ocornut/imgui/releases/tag/v1.87
|
||||||
[1.86]: https://github.com/ocornut/imgui/releases/tag/v1.86
|
[1.86]: https://github.com/ocornut/imgui/releases/tag/v1.86
|
||||||
[1.85]: https://github.com/ocornut/imgui/releases/tag/v1.85
|
[1.85]: https://github.com/ocornut/imgui/releases/tag/v1.85
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
cabal-version: 3.0
|
cabal-version: 3.0
|
||||||
|
|
||||||
name: dear-imgui
|
name: dear-imgui
|
||||||
version: 2.1.3
|
version: 2.2.0
|
||||||
author: Oliver Charles
|
author: Oliver Charles
|
||||||
maintainer: ollie@ocharles.org.uk, aenor.realm@gmail.com
|
maintainer: ollie@ocharles.org.uk, aenor.realm@gmail.com
|
||||||
license: BSD-3-Clause
|
license: BSD-3-Clause
|
||||||
@ -370,25 +370,25 @@ executable vulkan
|
|||||||
build-depends:
|
build-depends:
|
||||||
dear-imgui
|
dear-imgui
|
||||||
, bytestring
|
, bytestring
|
||||||
>= 0.10.10.0 && < 0.12
|
>= 0.10.10.0 && < 0.13
|
||||||
, containers
|
, containers
|
||||||
^>= 0.6.2.1
|
>= 0.6.2.1 && < 0.7
|
||||||
, logging-effect
|
, logging-effect
|
||||||
^>= 1.3.12
|
>= 1.3.12 && < 1.5
|
||||||
, resourcet
|
, resourcet
|
||||||
^>= 1.2.4.2
|
>= 1.2.4.2 && < 1.3
|
||||||
, sdl2
|
, sdl2
|
||||||
^>= 2.5.3.0
|
>= 2.5.3.0 && < 2.6
|
||||||
, text-short
|
, text
|
||||||
^>= 0.1.3
|
>= 1.2.4 && < 2.1
|
||||||
, transformers
|
, transformers
|
||||||
>= 0.5.6 && < 0.7
|
>= 0.5.6 && < 0.7
|
||||||
, unliftio
|
, unliftio
|
||||||
>= 0.2.13 && < 0.2.19
|
>= 0.2.13 && < 0.3
|
||||||
, unliftio-core
|
, unliftio-core
|
||||||
^>= 0.2.0.1
|
>= 0.2.0.1 && < 0.3
|
||||||
, vector
|
, vector
|
||||||
^>= 0.12.1.2
|
>= 0.12.1.2 && < 0.14
|
||||||
, vulkan
|
, vulkan
|
||||||
>= 3.12
|
>= 3.12
|
||||||
, vulkan-utils
|
, vulkan-utils
|
||||||
|
@ -44,7 +44,7 @@ import Data.Traversable
|
|||||||
import Data.Word
|
import Data.Word
|
||||||
( Word32 )
|
( Word32 )
|
||||||
import Foreign.C.String
|
import Foreign.C.String
|
||||||
( CString )
|
( peekCString )
|
||||||
import Foreign.C.Types
|
import Foreign.C.Types
|
||||||
( CInt )
|
( CInt )
|
||||||
import Foreign.Ptr
|
import Foreign.Ptr
|
||||||
@ -53,8 +53,6 @@ import Foreign.Ptr
|
|||||||
-- bytestring
|
-- bytestring
|
||||||
import Data.ByteString
|
import Data.ByteString
|
||||||
( ByteString )
|
( ByteString )
|
||||||
import qualified Data.ByteString.Short as ShortByteString
|
|
||||||
( packCString )
|
|
||||||
|
|
||||||
-- containers
|
-- containers
|
||||||
import qualified Data.Map.Strict as Map
|
import qualified Data.Map.Strict as Map
|
||||||
@ -77,11 +75,13 @@ import qualified SDL
|
|||||||
import qualified SDL.Raw
|
import qualified SDL.Raw
|
||||||
import qualified SDL.Video.Vulkan
|
import qualified SDL.Video.Vulkan
|
||||||
|
|
||||||
-- text-short
|
-- text
|
||||||
import Data.Text.Short
|
import Data.Text
|
||||||
( ShortText )
|
( Text )
|
||||||
import qualified Data.Text.Short as ShortText
|
import qualified Data.Text as Text
|
||||||
( intercalate, pack, fromShortByteString, toByteString, unpack )
|
( intercalate, pack, unpack )
|
||||||
|
import Data.Text.Encoding
|
||||||
|
( encodeUtf8 )
|
||||||
|
|
||||||
-- transformers
|
-- transformers
|
||||||
import Control.Monad.IO.Class
|
import Control.Monad.IO.Class
|
||||||
@ -118,7 +118,7 @@ import Attachments
|
|||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
type LogMessage = WithSeverity ShortText
|
type LogMessage = WithSeverity Text
|
||||||
class ( MonadUnliftIO m, MonadResource m, MonadLog LogMessage m ) => MonadVulkan m
|
class ( MonadUnliftIO m, MonadResource m, MonadLog LogMessage m ) => MonadVulkan m
|
||||||
instance ( MonadUnliftIO m, MonadResource m, MonadLog LogMessage m ) => MonadVulkan m
|
instance ( MonadUnliftIO m, MonadResource m, MonadLog LogMessage m ) => MonadVulkan m
|
||||||
|
|
||||||
@ -127,9 +127,9 @@ instance ( MonadUnliftIO m, MonadResource m, MonadLog LogMessage m ) => MonadVul
|
|||||||
|
|
||||||
logHandler :: MonadIO m => LogMessage -> m ()
|
logHandler :: MonadIO m => LogMessage -> m ()
|
||||||
logHandler ( WithSeverity sev mess )
|
logHandler ( WithSeverity sev mess )
|
||||||
= liftIO . putStrLn . ShortText.unpack $ showSeverity sev <> " " <> mess
|
= liftIO . putStrLn . Text.unpack $ showSeverity sev <> " " <> mess
|
||||||
|
|
||||||
showSeverity :: Severity -> ShortText
|
showSeverity :: Severity -> Text
|
||||||
showSeverity Emergency = "! PANIC !"
|
showSeverity Emergency = "! PANIC !"
|
||||||
showSeverity Alert = "! ALERT !"
|
showSeverity Alert = "! ALERT !"
|
||||||
showSeverity Critical = "! CRIT !"
|
showSeverity Critical = "! CRIT !"
|
||||||
@ -244,7 +244,7 @@ vulkanInstanceInfo appName = do
|
|||||||
|
|
||||||
case validationLayer of
|
case validationLayer of
|
||||||
Nothing -> logInfo "Validation layer unavailable. Is the Vulkan SDK installed?"
|
Nothing -> logInfo "Validation layer unavailable. Is the Vulkan SDK installed?"
|
||||||
Just _ -> logInfo ( "Enabled validation layers " <> ShortText.pack ( show enabledLayers ) )
|
Just _ -> logInfo ( "Enabled validation layers " <> Text.pack ( show enabledLayers ) )
|
||||||
|
|
||||||
pure createInfo
|
pure createInfo
|
||||||
|
|
||||||
@ -305,26 +305,23 @@ initialiseWindow ( WindowInfo { height, width, windowName, mouseMode } ) = do
|
|||||||
void ( SDL.setMouseLocationMode mouseMode )
|
void ( SDL.setMouseLocationMode mouseMode )
|
||||||
window <- logDebug "Creating SDL window" *> createWindow width height windowName
|
window <- logDebug "Creating SDL window" *> createWindow width height windowName
|
||||||
neededExtensions <- logDebug "Loading needed extensions" *> SDL.Video.Vulkan.vkGetInstanceExtensions window
|
neededExtensions <- logDebug "Loading needed extensions" *> SDL.Video.Vulkan.vkGetInstanceExtensions window
|
||||||
extensionNames <- traverse ( liftIO . peekCString ) neededExtensions
|
extensionNames <- traverse ( liftIO . fmap fromString . peekCString ) neededExtensions
|
||||||
logInfo $ "Needed instance extensions are: " <> ShortText.intercalate ", " extensionNames
|
logInfo $ "Needed instance extensions are: " <> Text.intercalate ", " extensionNames
|
||||||
pure ( window, map ShortText.toByteString extensionNames )
|
pure ( window, map encodeUtf8 extensionNames )
|
||||||
|
|
||||||
peekCString :: CString -> IO ShortText
|
|
||||||
peekCString = fmap ( fromMaybe "???" . ShortText.fromShortByteString ) . ShortByteString.packCString
|
|
||||||
|
|
||||||
data WindowInfo
|
data WindowInfo
|
||||||
= WindowInfo
|
= WindowInfo
|
||||||
{ width :: CInt
|
{ width :: CInt
|
||||||
, height :: CInt
|
, height :: CInt
|
||||||
, windowName :: ShortText
|
, windowName :: Text
|
||||||
, mouseMode :: SDL.LocationMode
|
, mouseMode :: SDL.LocationMode
|
||||||
}
|
}
|
||||||
|
|
||||||
createWindow :: MonadVulkan m => CInt -> CInt -> ShortText -> m SDL.Window
|
createWindow :: MonadVulkan m => CInt -> CInt -> Text -> m SDL.Window
|
||||||
createWindow x y title =
|
createWindow x y title =
|
||||||
snd <$> ResourceT.allocate
|
snd <$> ResourceT.allocate
|
||||||
( SDL.createWindow
|
( SDL.createWindow
|
||||||
( fromString ( ShortText.unpack title ) )
|
( fromString ( Text.unpack title ) )
|
||||||
SDL.defaultWindow
|
SDL.defaultWindow
|
||||||
{ SDL.windowGraphicsContext = SDL.VulkanContext
|
{ SDL.windowGraphicsContext = SDL.VulkanContext
|
||||||
, SDL.windowInitialSize = SDL.V2 x y
|
, SDL.windowInitialSize = SDL.V2 x y
|
||||||
@ -404,8 +401,6 @@ createSwapchain physicalDevice device surface surfaceFormat imageUsage imageCoun
|
|||||||
|
|
||||||
surfaceCapabilities <- Vulkan.getPhysicalDeviceSurfaceCapabilitiesKHR physicalDevice ( Vulkan.SurfaceKHR surface )
|
surfaceCapabilities <- Vulkan.getPhysicalDeviceSurfaceCapabilitiesKHR physicalDevice ( Vulkan.SurfaceKHR surface )
|
||||||
|
|
||||||
( _, presentModes ) <- Vulkan.getPhysicalDeviceSurfacePresentModesKHR physicalDevice ( Vulkan.SurfaceKHR surface )
|
|
||||||
|
|
||||||
let
|
let
|
||||||
presentMode :: Vulkan.PresentModeKHR
|
presentMode :: Vulkan.PresentModeKHR
|
||||||
presentMode =
|
presentMode =
|
||||||
|
2
imgui
2
imgui
@ -1 +1 @@
|
|||||||
Subproject commit d4ddc46e7773e9a9b68f965d007968f35ca4e09a
|
Subproject commit c6e0284ac58b3f205c95365478888f7b53b077e2
|
Loading…
Reference in New Issue
Block a user