Simplify bounds clipping a tiny bit
This commit is contained in:
@@ -22,6 +22,17 @@ type IsoPt struct {
|
||||
func (s *Scenario) Update(screenX, screenY int) error {
|
||||
s.tick += 1
|
||||
|
||||
x, y := ebiten.CursorPosition()
|
||||
screenPos := CartPt{
|
||||
X: float64(s.Viewpoint.X + x),
|
||||
Y: float64(s.Viewpoint.Y + y),
|
||||
}
|
||||
|
||||
s.selectedCell = screenPos.ToISO()
|
||||
|
||||
// TODO: zoom support will need a camera
|
||||
// FIXME: adjust for Z level
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -33,13 +44,15 @@ func (s *Scenario) Draw(screen *ebiten.Image) error {
|
||||
|
||||
sw, sh := screen.Size()
|
||||
|
||||
topLeft := CartPt{X: float64(s.Viewpoint.X), Y: float64(s.Viewpoint.Y)}.ToISO()
|
||||
topLeft.X -= 5 // Ensure we paint to every visible section of the screeen.
|
||||
topLeft.X -= 5 // FIXME: haxxx
|
||||
topLeft := CartPt{
|
||||
X: float64(s.Viewpoint.X - 2*cellWidth), // Ensure all visible cells are rendered
|
||||
Y: float64(s.Viewpoint.Y - 2*cellHeight),
|
||||
}.ToISO()
|
||||
|
||||
bottomRight := CartPt{X: float64(s.Viewpoint.X + sw), Y: float64(s.Viewpoint.Y + sh)}.ToISO()
|
||||
bottomRight.X += 5
|
||||
bottomRight.Y += 5
|
||||
bottomRight := CartPt{
|
||||
X: float64(s.Viewpoint.X + sw + 2*cellHeight),
|
||||
Y: float64(s.Viewpoint.Y + sh + 5*cellHeight), // Z dimension requires it
|
||||
}.ToISO()
|
||||
|
||||
// X+Y is constant for all tiles in a column
|
||||
// X-Y is constant for all tiles in a row
|
||||
|
Reference in New Issue
Block a user