func LocalThink(sys system.System, engine *cgf.Engine, game *Game) { sys.Think() engine.Pause() // We might have no level if the event has not gone through yet. if game.Level != nil { render.Queue(func() { game.Render() sys.SwapBuffers() }) game.Level.LocalThink(sys, engine) } render.Purge() engine.Unpause() }
func debugHookup(version string) *cgf.Engine { var err error for false && len(sys.GetActiveDevices()[gin.DeviceTypeController]) < 2 { time.Sleep(time.Millisecond * 100) sys.Think() } var engine *cgf.Engine if version != "host" { engine, err = cgf.NewClientEngine(17, "thunderingvictory.dyndns.org", 20007, base.EmailCrashReport, base.Log()) if err != nil { base.Log().Printf("Unable to connect: %v", err) base.Error().Fatalf("%v", err.Error()) } } else { sys.Think() g := game.MakeGame() if version == "host" { engine, err = cgf.NewHostEngine(g, 17, "", 20007, base.EmailCrashReport, base.Log()) if err != nil { panic(err) } err = cgf.Host(20007, "thunderball") if err != nil { panic(err) } } else { engine, err = cgf.NewLocalEngine(g, 17, base.EmailCrashReport, base.Log()) } if err != nil { base.Error().Fatalf("%v", err.Error()) } } engine.Pause() engine.GetState().(*game.Game).SetSystem(sys) engine.Unpause() base.Log().Printf("Engine Id: %v", engine.Id()) base.Log().Printf("All Ids: %v", engine.Ids()) return engine }