diff --git a/culling.go b/culling.go index ec562ed..849b86e 100644 --- a/culling.go +++ b/culling.go @@ -1,9 +1,5 @@ package goga -import ( - "log" -) - const ( culling_2d_name = "culling2d" ) @@ -90,10 +86,8 @@ func (c *Culling2D) Update(delta float64) { c.cullables[i].Pos.Y > c.viewport.W || c.cullables[i].Pos.Y+c.cullables[i].Size.Y < c.viewport.Y { c.cullables[i].Visible = false - log.Print("h") } else { c.cullables[i].Visible = true - log.Print("s") } } } diff --git a/demo/sprite/sprite.go b/demo/sprite/sprite.go index 97f7dfe..6924f5e 100644 --- a/demo/sprite/sprite.go +++ b/demo/sprite/sprite.go @@ -26,7 +26,21 @@ func (g *Game) Setup() { } sprite := goga.NewSprite(tex) - goga.AddActor(sprite) + renderer, ok := goga.GetSystemByName("spriteRenderer").(*goga.SpriteRenderer) + + if !ok { + panic("Could not find renderer") + } + + renderer.Add(sprite.Actor, sprite.Pos2D, sprite.Tex) + + culling, ok := goga.GetSystemByName("culling2d").(*goga.Culling2D) + + if !ok { + panic("Could not find culling") + } + + culling.Add(sprite.Actor, sprite.Pos2D) } func (g *Game) Update(delta float64) {} diff --git a/game.go b/game.go index 15b00de..4eb608f 100644 --- a/game.go +++ b/game.go @@ -226,6 +226,7 @@ func initGoga(width, height int) { ClearColorBuffer(true) EnableAlphaBlending(true) AddLoader(&PngLoader{gl.LINEAR, false}) + AddLoader(&PlyLoader{gl.STATIC_DRAW}) AddSystem(NewSpriteRenderer(nil, nil, false)) AddSystem(NewCulling2D(0, 0, width, height)) }