Skip to content

Instantly share code, notes, and snippets.

@Forsevin
Created May 11, 2014 19:54
Show Gist options
  • Save Forsevin/040e3a9b3c8bc08b7332 to your computer and use it in GitHub Desktop.
Save Forsevin/040e3a9b3c8bc08b7332 to your computer and use it in GitHub Desktop.
func (r *RenderSystem) Begin() {
r.platform.renderer.renderer.Clear()
}
func (r *RenderSystem) Process() {
for _, entity := range r.entities {
aspect := entity.GetComponent(new(AspectComponent)).(*AspectComponent)
sprite := entity.GetComponent(new(SpriteComponent)).(*SpriteComponent)
src := sdl.Rect{0, 0, 512, 512}
var w, h int
sdl.QueryTexture(sprite.tex, nil, nil, &w, &h)
dst := sdl.Rect{aspect.x, aspect.y, int32(w), int32(h)}
r.platform.renderer.renderer.Copy(sprite.tex, &src, &dst)
}
}
func (r *RenderSystem) End() {
r.platform.renderer.renderer.Present()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment