-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.go
More file actions
38 lines (32 loc) · 748 Bytes
/
debug.go
File metadata and controls
38 lines (32 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package egriden
import (
"image/color"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/vector"
)
// Draws a checkerboard pattern with specified colors that represents
// the cells of the GridLayer
func (l *GridLayer) DebugDrawCheckerBoard(
c1, c2 color.Color, on *ebiten.Image) {
w, h := l.layerDimensions.WH()
currentColor := c1
flipper := true
for x := range w {
for y := range h {
if flipper {
currentColor = c1
} else {
currentColor = c2
}
rec := l.CellAt(x, y).BoundsRectangle()
vector.FillRect(on,
float32(rec.Min.X), float32(rec.Min.Y),
float32(rec.Dx()), float32(rec.Dy()),
currentColor, false)
flipper = !flipper
}
if w%2 == 0 {
flipper = !flipper
}
}
}