Start function in Game interface

This commit is contained in:
bloeys
2022-02-27 11:21:15 +04:00
parent d1f47316ae
commit f1b6f3a7c0
2 changed files with 7 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import (
type Game interface { type Game interface {
Init() Init()
Start()
FrameStart() FrameStart()
Update() Update()
@ -26,11 +27,13 @@ func Run(g Game) {
w := g.GetWindow() w := g.GetWindow()
ui := g.GetImGUI() ui := g.GetImGUI()
g.Init()
//Simulate an imgui frame during init so any imgui calls are allowed within init //Simulate an imgui frame during init so any imgui calls are allowed within init
tempWidth, tempHeight := w.SDLWin.GetSize() tempWidth, tempHeight := w.SDLWin.GetSize()
tempFBWidth, tempFBHeight := w.SDLWin.GLGetDrawableSize() tempFBWidth, tempFBHeight := w.SDLWin.GLGetDrawableSize()
ui.FrameStart(float32(tempWidth), float32(tempHeight)) ui.FrameStart(float32(tempWidth), float32(tempHeight))
g.Init() g.Start()
ui.Render(float32(tempWidth), float32(tempHeight), tempFBWidth, tempFBHeight) ui.Render(float32(tempWidth), float32(tempHeight), tempFBWidth, tempFBHeight)
for g.ShouldRun() { for g.ShouldRun() {

View File

@ -98,6 +98,9 @@ func (g *OurGame) Init() {
simpleMat.SetUnifVec3("lightColor1", lightColor1) simpleMat.SetUnifVec3("lightColor1", lightColor1)
} }
func (g *OurGame) Start() {
}
func (g *OurGame) FrameStart() { func (g *OurGame) FrameStart() {
} }