Moveable viewport. Absolute positioning (for UI etc) is possible. Added distance-based bounder for projectiles etc as 'screen' is no longer a suitable bounder. Removed debug msg.

This commit is contained in:
stevenhowes
2022-03-27 17:02:32 +01:00
parent bfa9ab0037
commit 428e2d175c
7 changed files with 88 additions and 24 deletions
+6 -1
View File
@@ -46,11 +46,16 @@ func (sr *spriteRenderer) onUpdate() error {
}
func (sr *spriteRenderer) onDraw() error {
Position := sr.container.Position
if !sr.container.PositionAbsolute {
Position = vectorAdd(sr.container.Position, ViewPort.Position)
}
return drawTexture(
sr.tex,
VectorInt32{-1, -1},
VectorInt32{0, 0},
sr.container.Position,
Position,
sr.container.Rotation,
sr.container.Renderer)
}