Example #1
0
func main() {
	sys.Startup()
	err := gl.Init()
	if err != nil {
		base.Error().Fatalf("%v", err)
	}

	render.Init()
	render.Queue(func() {
		sys.CreateWindow(10, 10, wdx, wdy)
		sys.EnableVSync(true)
	})
	base.InitShaders()
	runtime.GOMAXPROCS(10)
	sys.Think()

	console := base.MakeConsole(wdx, wdy)
	controllers := getPlayers(console)
	base.Log().Printf("%v\n", controllers)
	go server.Main()

	base.LoadAllDictionaries()

	client, err := game.MakeClient("127.0.0.1", 1231)
	if err != nil {
		base.Error().Printf("Unable to connect to server: %v\n", err)
		return
	}
	mainLoop(client, controllers, console)
}
Example #2
0
func (d *Data) Bind() {
	if d.texture == 0 {
		if error_texture == 0 {
			makeErrorTexture()
		}
		gl.BindTexture(gl.TEXTURE_2D, error_texture)
		base.Log().Printf("Ninindg error etextures")
	} else {
		gl.BindTexture(gl.TEXTURE_2D, d.texture)
	}
}
Example #3
0
func init() {
	runtime.LockOSThread()
	sys = system.Make(gos.GetSystemInterface())

	datadir = filepath.Join(os.Args[0], "..", "..")
	base.SetDatadir(datadir)
	base.Log().Printf("Setting datadir: %s", datadir)
	wdx = 1000
	wdy = 800
	var key_binds base.KeyBinds
	base.LoadJson(filepath.Join(datadir, "key_binds.json"), &key_binds)
	fmt.Printf("Prething: %v\n", key_binds)
	key_map = key_binds.MakeKeyMap()
	base.SetDefaultKeyMap(key_map)
}
Example #4
0
func renderCardReticle(selected bool, cardSize, cardX, cardY, x, y int) {
	base.Log().Printf("Rendering %d %d %d %d %d", cardSize, cardX, cardY, x, y)
	cx := x + cardX*cardSize
	cy := y + cardY*cardSize
	base.EnableShader("reticle")
	base.SetUniformF("reticle", "edge", 0.05)
	base.SetUniformF("reticle", "size", 0.1)
	if selected {
		base.SetUniformF("reticle", "coverage", 1.0)
	} else {
		base.SetUniformF("reticle", "coverage", 0.6)
	}
	texture.Render(float64(cx), float64(cy), float64(cardSize), float64(cardSize))
	base.EnableShader("")
}
Example #5
0
func (el *eventLogger) HandleEventGroup(group gin.EventGroup) {
	for _, event := range group.Events {
		base.Log().Printf("%v\n", event)
	}
}