Hello
I think that some restructuring of the code/API is needed to make ebiten-imgui support different TPS/FPS rates.
In usual Dear ImGui setup, you call Begin/EndFrame and widget creation functions in "Update", not "Draw". Actual drawing should be just just done in "Draw" function.
So, I think it's the usage should be like this:
func (g *Game) Update() {
g.mgr.BeginFrame()
// put stuff like imgui.Button etc. here
g.mgr.EndFrame()
}
func (g *Game) Draw(screen *ebiten.Image) {
g.mgr.Draw(screen) // new function - doesn't call "EndFrame" for us
}
This is much better and allows to have 60 TPS (update calls per second) and 60+ FPS (Draw calls per second) - we just need to render the old frame if Draw has been called more than once for 1 update call. Note that we can call imgui.Render once - it doesn't break anything.
Thoughts? If you agree with this, I can make a PR which implements the changes, though it'll break the API.
Hello I think that some restructuring of the code/API is needed to make ebiten-imgui support different TPS/FPS rates.
In usual Dear ImGui setup, you call Begin/EndFrame and widget creation functions in "Update", not "Draw". Actual drawing should be just just done in "Draw" function.
So, I think it's the usage should be like this:
This is much better and allows to have 60 TPS (update calls per second) and 60+ FPS (Draw calls per second) - we just need to render the old frame if Draw has been called more than once for 1 update call. Note that we can call
imgui.Render
once - it doesn't break anything.Thoughts? If you agree with this, I can make a PR which implements the changes, though it'll break the API.