mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
all: rename sizeInPoints -> sizeInPixels
This commit is contained in:
parent
f2180a5dc5
commit
586a4b6d6e
@ -358,12 +358,12 @@ func (t *Tile) Draw(boardImage *ebiten.Image) {
|
|||||||
boardImage.DrawImage(tileImage, op)
|
boardImage.DrawImage(tileImage, op)
|
||||||
str := strconv.Itoa(v)
|
str := strconv.Itoa(v)
|
||||||
|
|
||||||
sizeInPoints := 48.0
|
sizeInPixels := 48.0
|
||||||
switch {
|
switch {
|
||||||
case 3 < len(str):
|
case 3 < len(str):
|
||||||
sizeInPoints = 24
|
sizeInPixels = 24
|
||||||
case 2 < len(str):
|
case 2 < len(str):
|
||||||
sizeInPoints = 32
|
sizeInPixels = 32
|
||||||
}
|
}
|
||||||
|
|
||||||
textOp := &text.DrawOptions{}
|
textOp := &text.DrawOptions{}
|
||||||
@ -373,6 +373,6 @@ func (t *Tile) Draw(boardImage *ebiten.Image) {
|
|||||||
textOp.SecondaryAlign = text.AlignCenter
|
textOp.SecondaryAlign = text.AlignCenter
|
||||||
text.Draw(boardImage, str, &text.GoTextFace{
|
text.Draw(boardImage, str, &text.GoTextFace{
|
||||||
Source: mplusFaceSource,
|
Source: mplusFaceSource,
|
||||||
SizeInPixels: sizeInPoints,
|
SizeInPixels: sizeInPixels,
|
||||||
}, textOp)
|
}, textOp)
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ func (g *GoTextFace) outputCacheKey(text string) goTextOutputCacheKey {
|
|||||||
return goTextOutputCacheKey{
|
return goTextOutputCacheKey{
|
||||||
text: text,
|
text: text,
|
||||||
direction: g.Direction,
|
direction: g.Direction,
|
||||||
sizeInPoints: g.SizeInPixels,
|
sizeInPixels: g.SizeInPixels,
|
||||||
language: g.Language.String(),
|
language: g.Language.String(),
|
||||||
script: g.Script.String(),
|
script: g.Script.String(),
|
||||||
variations: g.ensureVariationsString(),
|
variations: g.ensureVariationsString(),
|
||||||
|
@ -29,7 +29,7 @@ import (
|
|||||||
type goTextOutputCacheKey struct {
|
type goTextOutputCacheKey struct {
|
||||||
text string
|
text string
|
||||||
direction Direction
|
direction Direction
|
||||||
sizeInPoints float64
|
sizeInPixels float64
|
||||||
language string
|
language string
|
||||||
script string
|
script string
|
||||||
variations string
|
variations string
|
||||||
@ -215,6 +215,6 @@ func (g *GoTextFaceSource) shape(text string, face *GoTextFace) (shaping.Output,
|
|||||||
return out, gs
|
return out, gs
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GoTextFaceSource) scale(sizeInPoints float64) float64 {
|
func (g *GoTextFaceSource) scale(sizeInPixels float64) float64 {
|
||||||
return sizeInPoints / float64(g.f.Upem())
|
return sizeInPixels / float64(g.f.Upem())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user