File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import (
1414 "os"
1515
1616 "github.com/hajimehoshi/ebiten/v2"
17+ "github.com/hajimehoshi/ebiten/v2/ebitenutil"
1718
1819 "github.com/ebitengine/debugui"
1920)
@@ -29,7 +30,8 @@ type Game struct {
2930 vy int
3031 hiRes bool
3132
32- debugUI debugui.DebugUI
33+ debugUI debugui.DebugUI
34+ inputCaptured bool
3335
3436 logBuf string
3537 logSubmitBuf string
@@ -82,14 +84,16 @@ func (g *Game) Update() error {
8284 if ebiten .IsKeyPressed (ebiten .KeyEscape ) {
8385 return ebiten .Termination
8486 }
85- if err := g .debugUI .Update (func (ctx * debugui.Context ) error {
87+ inputCaptured , err := g .debugUI .Update (func (ctx * debugui.Context ) error {
8688 g .testWindow (ctx )
8789 g .logWindow (ctx )
8890 g .buttonWindows (ctx )
8991 return nil
90- }); err != nil {
92+ })
93+ if err != nil {
9194 return err
9295 }
96+ g .inputCaptured = inputCaptured
9397 return nil
9498}
9599
@@ -99,6 +103,10 @@ func (g *Game) Draw(screen *ebiten.Image) {
99103 op .GeoM .Translate (float64 (g .x ), float64 (g .y ))
100104 screen .DrawImage (g .gopherImage , op )
101105
106+ if g .inputCaptured {
107+ ebitenutil .DebugPrint (screen , "Input captured by DebugUI" )
108+ }
109+
102110 g .debugUI .Draw (screen )
103111}
104112
You can’t perform that action at this time.
0 commit comments