haskell-game / dear-imgui.hs

Haskell bindings to Dear ImGui, an immediate mode GUI toolkit
BSD 3-Clause "New" or "Revised" License
142 stars 31 forks source link

Bracket for Push/Pop functions #63

Closed michael-swan closed 3 years ago

michael-swan commented 3 years ago

It seems fairly obvious that a bracket-style scoping of ImGuiContext mutation should be supported per the dear-imgui.hs API. My intuition says to more-or-less implement a function such as:

setStyleVar :: (MonadIO m) => StyleVar -> StyleVarValue -> m a -> m a
setStyleVars :: (MonadIO m) => [(StyleVar, StyleVarValue)] -> m a -> m a

this would effectively invoke pushStyleVar with its first two parameters, invoke the provided MonadIO instance, and then invoke popStyleVar.