本文整理汇总了Golang中github.com/runningwild/magnus/game.Game.Room方法的典型用法代码示例。如果您正苦于以下问题:Golang Game.Room方法的具体用法?Golang Game.Room怎么用?Golang Game.Room使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/runningwild/magnus/game.Game
的用法示例。
在下文中一共展示了Game.Room方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
fmt.Printf("%v\n", key_map)
sys.Startup()
err := gl.Init()
if err != nil {
panic(err)
}
render.Init()
render.Queue(func() {
sys.CreateWindow(10, 10, wdx, wdy)
sys.EnableVSync(true)
err := gl.Init()
if err != nil {
panic(err)
}
})
base.InitShaders()
runtime.GOMAXPROCS(2)
ui, err = gui.Make(gin.In(), gui.Dims{wdx, wdy}, filepath.Join(datadir, "fonts", "skia.ttf"))
if err != nil {
panic(err)
}
sys.Think()
for false && len(sys.GetActiveDevices()[gin.DeviceTypeController]) < 2 {
time.Sleep(time.Millisecond * 100)
sys.Think()
}
var ids []int
var engine *cgf.Engine
var room game.Room
err = base.LoadJson(filepath.Join(base.GetDataDir(), "rooms/basic.json"), &room)
if err != nil {
panic(err)
}
if IsHost() {
sys.Think()
var g game.Game
g.Rng = cmwc.MakeGoodCmwc()
g.Rng.SeedWithDevRand()
g.Dx = 900
g.Dy = 600
g.Friction = 0.97
g.Friction_lava = 0.85
g.Room = room
var p game.Player
p.Color.R = 255
err := json.NewDecoder(bytes.NewBuffer([]byte(`
{
"Base": {
"Max_turn": 0.07,
"Max_acc": 0.2,
"Mass": 750,
"Max_rate": 10,
"Influence": 75,
"Health": 1000
},
"Dynamic": {
"Health": 1000
}
}
`))).Decode(&p.Stats)
if err != nil {
panic(err)
}
Nx := 2
Ny := 1
p.X = float64(g.Dx-Nx)/2 - 200
p.Y = float64(g.Dy-Ny)/2 - 200
for x := 0; x < Nx; x++ {
for y := 0; y < Ny; y++ {
p.X += float64(x * 25)
p.Y += float64(y * 25)
p.Gid++
// p.Mass += float64(x+y) * 150
p.Processes = make(map[int]game.Process)
temp := p
ids = append(ids, g.AddEnt(&temp))
// 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
//.........这里部分代码省略.........