本文整理汇总了Golang中github.com/runningwild/cgf.Engine.CopyState方法的典型用法代码示例。如果您正苦于以下问题:Golang Engine.CopyState方法的具体用法?Golang Engine.CopyState怎么用?Golang Engine.CopyState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/runningwild/cgf.Engine
的用法示例。
在下文中一共展示了Engine.CopyState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: main
//.........这里部分代码省略.........
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)
// up_axis := gin.In().GetKeyFlat(gin.ControllerAxis0Negative+1, gin.DeviceTypeController, gin.DeviceIndexAny)
// right_axis := gin.In().GetKeyFlat(gin.ControllerAxis0Positive, gin.DeviceTypeController, gin.DeviceIndexAny)
// left_axis := gin.In().GetKeyFlat(gin.ControllerAxis0Negative, gin.DeviceTypeController, gin.DeviceIndexAny)
// up := key_map[fmt.Sprintf("%dup", i)].FramePressAvg()
// down := key_map[fmt.Sprintf("%ddown", i)].FramePressAvg()
// left := key_map[fmt.Sprintf("%dleft", i)].FramePressAvg()