Ejemplo n.º 1
0
func main() {
	game := &Game{}
	game.EventSystem = lbricks.CreateEventSystem(100)

	signal := game.EventSystem.FromEvent("MouseEvent")

	signal.Filter(func(value interface{}) bool {
		return value.(lbricks.MouseEvent).Action == lbricks.LEFT_BUTTON_DOWN
	}).
		Subscribe(func(value interface{}) {
			on = true
			fmt.Println("From Subscribe True", value)
		})

	signal2 := game.EventSystem.FromEvent("MouseEvent")
	signal2.Filter(func(value interface{}) bool {
		return value.(lbricks.MouseEvent).Action == lbricks.LEFT_BUTTON_UP
	}).
		Subscribe(func(value interface{}) {
			on = false
			fmt.Println("From Subscribe False", value)

		})
	engi.Open("Botmark", 800, 600, false, game)
}
Ejemplo n.º 2
0
func (g *Game) InitContext() {
	g.EventSystem = &lbricks.CreateEventSystem(100)

}