本文整理匯總了Golang中github.com/runningwild/magnus/game.Game.SetEngine方法的典型用法代碼示例。如果您正苦於以下問題:Golang Game.SetEngine方法的具體用法?Golang Game.SetEngine怎麽用?Golang Game.SetEngine使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/runningwild/magnus/game.Game
的用法示例。
在下文中一共展示了Game.SetEngine方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: main
//.........這裏部分代碼省略.........
// p.Mass -= float64(x+y) * 150
p.X -= float64(x * 25)
p.Y -= float64(y * 25)
}
}
g.Ents[0].(*game.Player).X = 500
g.Ents[0].(*game.Player).Y = 300
g.Ents[1].(*game.Player).X = 550
g.Ents[1].(*game.Player).Y = 300
g.SetLocalData()
d := sys.GetActiveDevices()
base.Log().Printf("%v\n", d)
n := 0
base.Log().Printf("%v\n", d[gin.DeviceTypeController])
for _, index := range d[gin.DeviceTypeController] {
// panic("ASD")
g.SetLocalPlayer(g.Ents[n].(*game.Player), index)
n++
if n > 2 {
break
}
}
if len(d[gin.DeviceTypeController]) == 0 {
g.SetLocalPlayer(g.Ents[0].(*game.Player), 0)
}
// g.Ents[0], g.Ents[(N*N)/2+(1-N%2)*N/2] = g.Ents[(N*N)/2+(1-N%2)*N/2], g.Ents[0]
g.Init()
// engine, err = cgf.NewLocalEngine(&g, 17, base.Log())
engine, err = cgf.NewHostEngine(&g, 17, "", 1231, base.Log())
if err != nil {
panic(err.Error())
}
g.SetEngine(engine)
} else {
engine, err = cgf.NewClientEngine(17, "", 1231, base.Log())
if err != nil {
panic(err.Error())
}
engine.CopyState().(*game.Game).SetEngine(engine)
}
anchor := gui.MakeAnchorBox(gui.Dims{wdx, wdy})
ui.AddChild(anchor)
anchor.AddChild(&game.GameWindow{Engine: engine}, gui.Anchor{0.5, 0.5, 0.5, 0.5})
var v float64
var profile_output *os.File
var num_mem_profiles int
// ui.AddChild(base.MakeConsole())
base.LoadAllDictionaries()
for gin.In().GetKey(gin.AnyEscape).FramePressCount() == 0 {
sys.Think()
render.Queue(func() {
ui.Draw()
})
render.Queue(func() {
sys.SwapBuffers()
})
render.Purge()
game.LocalThink()
if IsHost() {
for i := 0; i <= 0; i++ {
// down_axis := gin.In().GetKeyFlat(gin.ControllerAxis0Positive+1, gin.DeviceTypeController, gin.DeviceIndexAny)