mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2024-11-22 16:57:00 +00:00
Add functions for getting window position and size (#89)
- getWindowPos - getWindowSize - getWindowWidth - getWindowHeight Closes #88
This commit is contained in:
parent
08b3139477
commit
be7aa1e9b1
@ -49,6 +49,15 @@ module DearImGui
|
|||||||
|
|
||||||
, begin
|
, begin
|
||||||
, Raw.end
|
, Raw.end
|
||||||
|
|
||||||
|
-- ** Utilities
|
||||||
|
|
||||||
|
, Raw.getWindowPos
|
||||||
|
, Raw.getWindowSize
|
||||||
|
, Raw.getWindowWidth
|
||||||
|
, Raw.getWindowHeight
|
||||||
|
|
||||||
|
-- ** Manipulation
|
||||||
, setNextWindowPos
|
, setNextWindowPos
|
||||||
, setNextWindowSize
|
, setNextWindowSize
|
||||||
, Raw.setNextWindowFullscreen
|
, Raw.setNextWindowFullscreen
|
||||||
@ -57,7 +66,7 @@ module DearImGui
|
|||||||
, setNextWindowCollapsed
|
, setNextWindowCollapsed
|
||||||
, setNextWindowBgAlpha
|
, setNextWindowBgAlpha
|
||||||
|
|
||||||
-- * Child Windows
|
-- ** Child Windows
|
||||||
, withChild
|
, withChild
|
||||||
, withChildOpen
|
, withChildOpen
|
||||||
, beginChild
|
, beginChild
|
||||||
|
@ -43,6 +43,16 @@ module DearImGui.Raw
|
|||||||
-- * Windows
|
-- * Windows
|
||||||
, begin
|
, begin
|
||||||
, end
|
, end
|
||||||
|
|
||||||
|
-- ** Utilities
|
||||||
|
|
||||||
|
, getWindowPos
|
||||||
|
, getWindowSize
|
||||||
|
, getWindowWidth
|
||||||
|
, getWindowHeight
|
||||||
|
|
||||||
|
-- ** Manipulation
|
||||||
|
|
||||||
, setNextWindowPos
|
, setNextWindowPos
|
||||||
, setNextWindowSize
|
, setNextWindowSize
|
||||||
, setNextWindowFullscreen
|
, setNextWindowFullscreen
|
||||||
@ -51,7 +61,7 @@ module DearImGui.Raw
|
|||||||
, setNextWindowCollapsed
|
, setNextWindowCollapsed
|
||||||
, setNextWindowBgAlpha
|
, setNextWindowBgAlpha
|
||||||
|
|
||||||
-- * Child Windows
|
-- ** Child Windows
|
||||||
, beginChild
|
, beginChild
|
||||||
, endChild
|
, endChild
|
||||||
|
|
||||||
@ -1088,6 +1098,31 @@ isItemHovered :: (MonadIO m) => m Bool
|
|||||||
isItemHovered = liftIO do
|
isItemHovered = liftIO do
|
||||||
(0 /=) <$> [C.exp| bool { IsItemHovered() } |]
|
(0 /=) <$> [C.exp| bool { IsItemHovered() } |]
|
||||||
|
|
||||||
|
getWindowPos :: (MonadIO m) => m ImVec2
|
||||||
|
getWindowPos = liftIO do
|
||||||
|
C.withPtr_ \ptr ->
|
||||||
|
[C.block|
|
||||||
|
void {
|
||||||
|
*$(ImVec2 * ptr) = GetWindowPos();
|
||||||
|
}
|
||||||
|
|]
|
||||||
|
|
||||||
|
getWindowSize :: (MonadIO m) => m ImVec2
|
||||||
|
getWindowSize = liftIO do
|
||||||
|
C.withPtr_ \ptr ->
|
||||||
|
[C.block|
|
||||||
|
void {
|
||||||
|
*$(ImVec2 * ptr) = GetWindowSize();
|
||||||
|
}
|
||||||
|
|]
|
||||||
|
|
||||||
|
getWindowWidth :: (MonadIO m) => m CFloat
|
||||||
|
getWindowWidth = liftIO do
|
||||||
|
[C.exp| float { GetWindowWidth() } |]
|
||||||
|
|
||||||
|
getWindowHeight :: (MonadIO m) => m CFloat
|
||||||
|
getWindowHeight = liftIO do
|
||||||
|
[C.exp| float { GetWindowHeight() } |]
|
||||||
|
|
||||||
-- | Set next window position. Call before `begin` Use pivot=(0.5,0.5) to center on given point, etc.
|
-- | Set next window position. Call before `begin` Use pivot=(0.5,0.5) to center on given point, etc.
|
||||||
--
|
--
|
||||||
|
Loading…
Reference in New Issue
Block a user