mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2024-11-26 02:27: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"
|
||||
False -> return ()
|
||||
|
||||
arrowButton "Arrow" ImGuiDirUp
|
||||
|
||||
end
|
||||
|
||||
render
|
||||
|
@ -1,6 +1,7 @@
|
||||
{-# LANGUAGE BlockArguments #-}
|
||||
{-# LANGUAGE NamedFieldPuns #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE PatternSynonyms #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
@ -53,6 +54,14 @@ module DearImGui
|
||||
-- ** Main
|
||||
, button
|
||||
, smallButton
|
||||
, arrowButton
|
||||
|
||||
-- * Types
|
||||
, ImGuiDir
|
||||
, pattern ImGuiDirLeft
|
||||
, pattern ImGuiDirRight
|
||||
, pattern ImGuiDirUp
|
||||
, pattern ImGuiDirDown
|
||||
)
|
||||
where
|
||||
|
||||
@ -278,3 +287,22 @@ button label = withCString label \labelPtr ->
|
||||
smallButton :: String -> IO Bool
|
||||
smallButton label = withCString label \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