mirror of
https://github.com/bloeys/nmage.git
synced 2025-12-29 13:28:20 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d7cd5bfc8d |
@ -23,14 +23,22 @@ type Game interface {
|
||||
func Run(g Game, w *Window, ui nmageimgui.ImguiInfo) {
|
||||
|
||||
isRunning = true
|
||||
g.Init()
|
||||
|
||||
//Simulate an imgui frame during init so any imgui calls are allowed within init
|
||||
// Simulate 2 imgui frames, one before and one after g.Init so any imgui calls are allowed within init.
|
||||
// Calling before is required for things like push font.
|
||||
tempWidth, tempHeight := w.SDLWin.GetSize()
|
||||
tempFBWidth, tempFBHeight := w.SDLWin.GLGetDrawableSize()
|
||||
ui.FrameStart(float32(tempWidth), float32(tempHeight))
|
||||
ui.Render(float32(tempWidth), float32(tempHeight), tempFBWidth, tempFBHeight)
|
||||
|
||||
g.Init()
|
||||
|
||||
// Second imgui frame
|
||||
tempWidth, tempHeight = w.SDLWin.GetSize()
|
||||
tempFBWidth, tempFBHeight = w.SDLWin.GLGetDrawableSize()
|
||||
ui.FrameStart(float32(tempWidth), float32(tempHeight))
|
||||
ui.Render(float32(tempWidth), float32(tempHeight), tempFBWidth, tempFBHeight)
|
||||
|
||||
for isRunning {
|
||||
|
||||
//PERF: Cache these
|
||||
|
||||
Reference in New Issue
Block a user