|
1 | 1 | {-# LANGUAGE BlockArguments #-}
|
2 | 2 | {-# LANGUAGE NamedFieldPuns #-}
|
3 | 3 | {-# LANGUAGE OverloadedStrings #-}
|
| 4 | +{-# LANGUAGE PatternSynonyms #-} |
4 | 5 | {-# LANGUAGE QuasiQuotes #-}
|
5 | 6 | {-# LANGUAGE TemplateHaskell #-}
|
6 | 7 |
|
@@ -53,6 +54,14 @@ module DearImGui
|
53 | 54 | -- ** Main
|
54 | 55 | , button
|
55 | 56 | , smallButton
|
| 57 | + , arrowButton |
| 58 | + |
| 59 | + -- * Types |
| 60 | + , ImGuiDir |
| 61 | + , pattern ImGuiDirLeft |
| 62 | + , pattern ImGuiDirRight |
| 63 | + , pattern ImGuiDirUp |
| 64 | + , pattern ImGuiDirDown |
56 | 65 | )
|
57 | 66 | where
|
58 | 67 |
|
@@ -278,3 +287,22 @@ button label = withCString label \labelPtr ->
|
278 | 287 | smallButton :: String -> IO Bool
|
279 | 288 | smallButton label = withCString label \labelPtr ->
|
280 | 289 | (1 ==) <$> [C.exp| bool { SmallButton($(char* labelPtr)) } |]
|
| 290 | + |
| 291 | + |
| 292 | +-- | Square button with an arrow shape. |
| 293 | +-- |
| 294 | +-- Wraps @ImGui::ArrowButton()@. |
| 295 | +arrowButton :: String -> ImGuiDir -> IO Bool |
| 296 | +arrowButton strId (ImGuiDir dir) = withCString strId \strIdPtr -> |
| 297 | + (1 ==) <$> [C.exp| bool { ArrowButton($(char* strIdPtr), $(int dir)) } |] |
| 298 | + |
| 299 | + |
| 300 | +-- | A cardinal direction. |
| 301 | +newtype ImGuiDir = ImGuiDir CInt |
| 302 | + |
| 303 | + |
| 304 | +pattern ImGuiDirLeft, ImGuiDirRight, ImGuiDirUp, ImGuiDirDown :: ImGuiDir |
| 305 | +pattern ImGuiDirLeft = ImGuiDir 0 |
| 306 | +pattern ImGuiDirRight = ImGuiDir 1 |
| 307 | +pattern ImGuiDirUp = ImGuiDir 2 |
| 308 | +pattern ImGuiDirDown = ImGuiDir 3 |
0 commit comments