mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 03:58:55 +01:00
ebitenutil: Remove debugPrintImageParts
This commit is contained in:
parent
691db07678
commit
b66ead56c8
@ -18,42 +18,11 @@ import (
|
|||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
"math"
|
"math"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten"
|
"github.com/hajimehoshi/ebiten"
|
||||||
"github.com/hajimehoshi/ebiten/ebitenutil/internal/assets"
|
"github.com/hajimehoshi/ebiten/ebitenutil/internal/assets"
|
||||||
)
|
)
|
||||||
|
|
||||||
type debugPrintImageParts string
|
|
||||||
|
|
||||||
func (f debugPrintImageParts) Len() int {
|
|
||||||
return len(f)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f debugPrintImageParts) Dst(i int) (x0, y0, x1, y1 int) {
|
|
||||||
cw, ch := assets.TextImageCharWidth, assets.TextImageCharHeight
|
|
||||||
x := i - strings.LastIndex(string(f)[:i], "\n") - 1
|
|
||||||
y := strings.Count(string(f)[:i], "\n")
|
|
||||||
x *= cw
|
|
||||||
y *= ch
|
|
||||||
if x < 0 {
|
|
||||||
return 0, 0, 0, 0
|
|
||||||
}
|
|
||||||
return x, y, x + cw, y + ch
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f debugPrintImageParts) Src(i int) (x0, y0, x1, y1 int) {
|
|
||||||
cw, ch := assets.TextImageCharWidth, assets.TextImageCharHeight
|
|
||||||
const n = assets.TextImageWidth / assets.TextImageCharWidth
|
|
||||||
code := int(f[i])
|
|
||||||
if code == '\n' {
|
|
||||||
return 0, 0, 0, 0
|
|
||||||
}
|
|
||||||
x := (code % n) * cw
|
|
||||||
y := (code / n) * ch
|
|
||||||
return x, y, x + cw, y + ch
|
|
||||||
}
|
|
||||||
|
|
||||||
type debugPrintState struct {
|
type debugPrintState struct {
|
||||||
textImage *ebiten.Image
|
textImage *ebiten.Image
|
||||||
debugPrintRenderTarget *ebiten.Image
|
debugPrintRenderTarget *ebiten.Image
|
||||||
|
Loading…
Reference in New Issue
Block a user