remove comments
This commit is contained in:
@@ -1,15 +1,5 @@
|
||||
package inc
|
||||
|
||||
// The HUD's coloured text rendering.
|
||||
//
|
||||
// inkwell's drawText (asset.text.go) discards its colour argument (`_ = c`) and
|
||||
// always renders white through the ebitenutil debug font. The two-channel
|
||||
// colour rule — "if something is amber, a tape said it" — cannot work through
|
||||
// it, so the custom widgets do not call Game.DrawText: they render glyphs onto
|
||||
// a scratch image and blit it tinted with ColorScale. The built-in widgets
|
||||
// (StatusLine, DialogBox, TopBar) still render white. See README, "Engine
|
||||
// workarounds".
|
||||
|
||||
import (
|
||||
"image"
|
||||
"image/color"
|
||||
@@ -19,9 +9,6 @@ import (
|
||||
"github.com/hajimehoshi/ebiten/v2/ebitenutil"
|
||||
)
|
||||
|
||||
// glyphW and glyphH are the ebitenutil debug font's cell. The engine's own
|
||||
// textWidth uses the same 6px but counts bytes, which mismeasures any
|
||||
// non-ASCII text; we count runes.
|
||||
const (
|
||||
glyphW = 6
|
||||
glyphH = 16
|
||||
@@ -29,10 +16,8 @@ const (
|
||||
|
||||
var scratch *ebiten.Image
|
||||
|
||||
// textW is the pixel width of a string, counted in runes.
|
||||
func textW(s string) int { return utf8.RuneCountInString(s) * glyphW }
|
||||
|
||||
// drawTextC draws one line in colour c, with the same origin as DebugPrintAt.
|
||||
func drawTextC(dst *ebiten.Image, s string, x, y int, c color.Color) {
|
||||
if s == "" {
|
||||
return
|
||||
@@ -60,8 +45,6 @@ func drawTextC(dst *ebiten.Image, s string, x, y int, c color.Color) {
|
||||
dst.DrawImage(scratch.SubImage(image.Rect(0, 0, w, h)).(*ebiten.Image), op)
|
||||
}
|
||||
|
||||
// wrap breaks s at word boundaries into lines no wider than maxPx. The engine's
|
||||
// wrapText is unexported and byte-based, hence our own.
|
||||
func wrap(s string, maxPx int) []string {
|
||||
if maxPx <= glyphW || textW(s) <= maxPx {
|
||||
return []string{s}
|
||||
@@ -108,7 +91,6 @@ func wrap(s string, maxPx int) []string {
|
||||
return out
|
||||
}
|
||||
|
||||
// clip truncates a string so it fits into maxPx.
|
||||
func clip(s string, maxPx int) string {
|
||||
r := []rune(s)
|
||||
max := maxPx / glyphW
|
||||
|
||||
Reference in New Issue
Block a user