mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2025-07-04 20:18:47 +02:00
Add withFullscreen and related machinery (#55)
- `fullscreenFlags` available for those who want an alternative to `withFullscreen` without reinventing too much. - Raw.begin got `open` and `flags` arguments. - Added Raw.setNextWindowFullscreen combo block.
This commit is contained in:
committed by
GitHub
parent
73eee5fc9e
commit
6ccee5234b
@ -45,6 +45,7 @@ module DearImGui.Raw
|
||||
, end
|
||||
, setNextWindowPos
|
||||
, setNextWindowSize
|
||||
, setNextWindowFullscreen
|
||||
, setNextWindowContentSize
|
||||
, setNextWindowSizeConstraints
|
||||
, setNextWindowCollapsed
|
||||
@ -312,9 +313,12 @@ styleColorsClassic = liftIO do
|
||||
-- matching 'end' for each 'begin' call, regardless of its return value!
|
||||
--
|
||||
-- Wraps @ImGui::Begin()@.
|
||||
begin :: (MonadIO m) => CString -> m Bool
|
||||
begin namePtr = liftIO do
|
||||
(0 /=) <$> [C.exp| bool { Begin($(char* namePtr)) } |]
|
||||
--
|
||||
-- Passing non-null @Ptr CBool@ shows a window-closing widget in the upper-right corner of the window,
|
||||
-- wich clicking will set the boolean to false when clicked.
|
||||
begin :: (MonadIO m) => CString -> Ptr CBool -> ImGuiWindowFlags -> m Bool
|
||||
begin namePtr openPtr flags = liftIO do
|
||||
(0 /=) <$> [C.exp| bool { Begin($(char* namePtr), $(bool* openPtr), $(ImGuiWindowFlags flags)) } |]
|
||||
|
||||
|
||||
-- | Pop window from the stack.
|
||||
@ -721,6 +725,20 @@ setNextWindowSize sizePtr cond = liftIO do
|
||||
[C.exp| void { SetNextWindowSize(*$(ImVec2* sizePtr), $(ImGuiCond cond)) } |]
|
||||
|
||||
|
||||
-- | Set next window size and position to match current display size.
|
||||
--
|
||||
-- Call before `begin`.
|
||||
--
|
||||
-- Wraps @ImGui::SetNextWindowPos()@, @ImGui::SetNextWindowSize()@
|
||||
setNextWindowFullscreen :: (MonadIO m) => m ()
|
||||
setNextWindowFullscreen = liftIO
|
||||
[C.block|
|
||||
void {
|
||||
SetNextWindowPos(ImVec2(0, 0));
|
||||
SetNextWindowSize(GetIO().DisplaySize);
|
||||
}
|
||||
|]
|
||||
|
||||
-- | Set next window content size (~ scrollable client area, which enforce the range of scrollbars). Not including window decorations (title bar, menu bar, etc.) nor WindowPadding. call before `begin`
|
||||
--
|
||||
-- Wraps @ImGui::SetNextWindowContentSize()@
|
||||
|
Reference in New Issue
Block a user