func main() { peer.LogDebug("[IN]") engine := simra.GetInstance() onStart := make(chan bool) onStop := make(chan bool) go eventHandle(onStart, onStop) engine.Start(onStart, onStop) peer.LogDebug("[OUT]") }
func eventHandle(onStart, onStop chan bool) { for { select { case <-onStart: peer.LogDebug("receive chan. onStart") engine := simra.GetInstance() // TODO: this will be called on rotation. // to keep state on rotation, SetScene must not call // every onStart. engine.SetScene(&scene.Title{}) case <-onStop: peer.LogDebug("receive chan. onStop") } } }
func (self *Title) OnTouchEnd(x, y float32) { // scene end. go to next scene simra.GetInstance().SetScene(&Stage1{}) }