Exemple #1
0
func main() {
	flag.Parse()

	v = game.NewVault()
	v.PlaceRoom(9, 0, 1)
	v.PlaceRoom(9, 1, 1)
	v.PlaceRoom(10, 1, 2)

	// setup transparency for sprites
	gl.Disable(gl.DEPTH_TEST)
	gl.Enable(gl.BLEND)
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)

	app.Main(func(a app.App) {
		var sz size.Event
		for e := range a.Events() {
			switch e := app.Filter(e).(type) {
			case size.Event:
				sz = e
			case paint.Event:
				onPaint(sz)
				a.EndPaint(e)
			}
		}
	})
}
Exemple #2
0
func main() {
	w, err := sdl2.NewWindow(
		"Hello",
		splish.Point{1920, 1080},
		false,
	)
	if err != nil {
		log.Fatal("NewWindow:", err)
	}

	v := game.NewVault()
	fmt.Println("wat")
	vr := basic.NewVaultRenderer(w, &v)
	fmt.Println("wat2")
	vr.Scene.View = splish.Rectangle{
		splish.Point{0, 0},
		splish.Point{1920 * 3, 1080 * 3},
	}
	fmt.Println(vr.Scene.Background.Layers[0])

	vr.SyncAndDraw()
	time.Sleep(2 * time.Second)
}