mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2024-11-26 10:37:00 +00:00
Wrap ImGui::ArrowButton()
This commit is contained in:
parent
4398950053
commit
0fb690d832
2
Main.hs
2
Main.hs
@ -51,6 +51,8 @@ loop w = do
|
|||||||
True -> putStrLn "Oh hi Mark"
|
True -> putStrLn "Oh hi Mark"
|
||||||
False -> return ()
|
False -> return ()
|
||||||
|
|
||||||
|
arrowButton "Arrow" ImGuiDirUp
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
render
|
render
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{-# LANGUAGE BlockArguments #-}
|
{-# LANGUAGE BlockArguments #-}
|
||||||
{-# LANGUAGE NamedFieldPuns #-}
|
{-# LANGUAGE NamedFieldPuns #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# LANGUAGE PatternSynonyms #-}
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
{-# LANGUAGE QuasiQuotes #-}
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
|
||||||
@ -53,6 +54,14 @@ module DearImGui
|
|||||||
-- ** Main
|
-- ** Main
|
||||||
, button
|
, button
|
||||||
, smallButton
|
, smallButton
|
||||||
|
, arrowButton
|
||||||
|
|
||||||
|
-- * Types
|
||||||
|
, ImGuiDir
|
||||||
|
, pattern ImGuiDirLeft
|
||||||
|
, pattern ImGuiDirRight
|
||||||
|
, pattern ImGuiDirUp
|
||||||
|
, pattern ImGuiDirDown
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
@ -278,3 +287,22 @@ button label = withCString label \labelPtr ->
|
|||||||
smallButton :: String -> IO Bool
|
smallButton :: String -> IO Bool
|
||||||
smallButton label = withCString label \labelPtr ->
|
smallButton label = withCString label \labelPtr ->
|
||||||
(1 ==) <$> [C.exp| bool { SmallButton($(char* labelPtr)) } |]
|
(1 ==) <$> [C.exp| bool { SmallButton($(char* labelPtr)) } |]
|
||||||
|
|
||||||
|
|
||||||
|
-- | Square button with an arrow shape.
|
||||||
|
--
|
||||||
|
-- Wraps @ImGui::ArrowButton()@.
|
||||||
|
arrowButton :: String -> ImGuiDir -> IO Bool
|
||||||
|
arrowButton strId (ImGuiDir dir) = withCString strId \strIdPtr ->
|
||||||
|
(1 ==) <$> [C.exp| bool { ArrowButton($(char* strIdPtr), $(int dir)) } |]
|
||||||
|
|
||||||
|
|
||||||
|
-- | A cardinal direction.
|
||||||
|
newtype ImGuiDir = ImGuiDir CInt
|
||||||
|
|
||||||
|
|
||||||
|
pattern ImGuiDirLeft, ImGuiDirRight, ImGuiDirUp, ImGuiDirDown :: ImGuiDir
|
||||||
|
pattern ImGuiDirLeft = ImGuiDir 0
|
||||||
|
pattern ImGuiDirRight = ImGuiDir 1
|
||||||
|
pattern ImGuiDirUp = ImGuiDir 2
|
||||||
|
pattern ImGuiDirDown = ImGuiDir 3
|
||||||
|
Loading…
Reference in New Issue
Block a user