tridoraemu: enable debug display via F12
This commit is contained in:
parent
d2cae9480c
commit
b2c2e8dc0c
3 changed files with 29 additions and 6 deletions
|
|
@ -8,7 +8,8 @@ import (
|
|||
"flag"
|
||||
"time"
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
// "github.com/hajimehoshi/ebiten/v2/ebitenutil"
|
||||
"github.com/hajimehoshi/ebiten/v2/ebitenutil"
|
||||
"github.com/hajimehoshi/ebiten/v2/inpututil"
|
||||
// "image/color"
|
||||
)
|
||||
|
||||
|
|
@ -35,6 +36,7 @@ func idle(canGoIdle bool) {
|
|||
}
|
||||
|
||||
type Game struct{
|
||||
debug bool
|
||||
x,y int
|
||||
stepsPerFrame int
|
||||
lastFrameDuration time.Duration
|
||||
|
|
@ -58,16 +60,23 @@ func (g *Game) Update() error {
|
|||
}
|
||||
g.lastFrameDuration = time.Since(startTime)
|
||||
|
||||
if inpututil.IsKeyJustReleased(ebiten.KeyF12) {
|
||||
g.debug = !g.debug
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *Game) Draw(screen *ebiten.Image) {
|
||||
screen.DrawImage(framebuffer.framebuffer, nil)
|
||||
|
||||
/*
|
||||
buf := fmt.Sprintf("PC: %08X FP: %08X RP: %08X ESP: %2X\n%v", cpu.PC, cpu.FP, cpu.RP, cpu.ESP, g.lastFrameDuration)
|
||||
ebitenutil.DebugPrint(screen, buf)
|
||||
if g.debug {
|
||||
buf := fmt.Sprintf("PC: %08X FP: %08X RP: %08X ESP: %2X %v",
|
||||
cpu.PC, cpu.FP, cpu.RP, cpu.ESP, g.lastFrameDuration)
|
||||
ebitenutil.DebugPrint(screen, buf)
|
||||
}
|
||||
|
||||
/*
|
||||
screen.Set(g.x, g.y, color.RGBA{255,0,0,0})
|
||||
screen.Set(g.x, g.y+1, color.RGBA{0,255,0,0})
|
||||
screen.Set(g.x, g.y+2, color.RGBA{0,255,255,0})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue