/
debug.go
57 lines (47 loc) · 1.16 KB
/
debug.go
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package world
import (
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/vector"
"golang.org/x/image/colornames"
)
func (w *World) debugPasswortLesen() {
const debugPasswort = "debug"
if w.debug {
return
}
w.debugPasswort = ebiten.AppendInputChars(w.debugPasswort)
if len(w.debugPasswort) > len(debugPasswort) {
w.debugPasswort = w.debugPasswort[len(w.debugPasswort)-len(debugPasswort):]
}
if string(w.debugPasswort) == debugPasswort {
w.debug = true
}
}
func (w *World) pfadeVisualisierenDebug(screen *ebiten.Image) {
if !w.debug {
return
}
camera := w.findCamera()
if camera == nil {
return
}
for entity := range w.Entities {
if entity.Level != camera.Level {
continue
}
if !entity.HatMoveToPositionsComponent {
continue
}
for i := entity.MoveToPositionsComponent.CurrentPosition; i < len(entity.MoveToPositionsComponent.Positions); i++ {
screenPositionX, screenPositionY := calculateScreenPosition(entity.MoveToPositionsComponent.Positions[i], camera)
vector.DrawFilledCircle(
screen,
float32(screenPositionX),
float32(screenPositionY),
10,
colornames.Purple,
true,
)
}
}
}