diff --git a/examples/2048/2048/game.go b/examples/2048/2048/game.go index 28825e9c6..dcdbdefef 100644 --- a/examples/2048/2048/game.go +++ b/examples/2048/2048/game.go @@ -28,8 +28,8 @@ func init() { } const ( - ScreenWidth = 210 - ScreenHeight = 300 + ScreenWidth = 420 + ScreenHeight = 600 boardSize = 4 ) diff --git a/examples/2048/2048/tile.go b/examples/2048/2048/tile.go index 9e4b0c548..a0c5d7279 100644 --- a/examples/2048/2048/tile.go +++ b/examples/2048/2048/tile.go @@ -34,6 +34,7 @@ import ( ) var ( + mplusSmallFont font.Face mplusNormalFont font.Face mplusBigFont font.Face ) @@ -56,13 +57,18 @@ func init() { } const dpi = 72 + mplusSmallFont = truetype.NewFace(tt, &truetype.Options{ + Size: 24, + DPI: dpi, + Hinting: font.HintingFull, + }) mplusNormalFont = truetype.NewFace(tt, &truetype.Options{ - Size: 12, + Size: 32, DPI: dpi, Hinting: font.HintingFull, }) mplusBigFont = truetype.NewFace(tt, &truetype.Options{ - Size: 24, + Size: 48, DPI: dpi, Hinting: font.HintingFull, }) @@ -341,8 +347,8 @@ func meanF(a, b float64, rate float64) float64 { } const ( - tileSize = 40 - tileMargin = 2 + tileSize = 80 + tileMargin = 4 ) var ( @@ -400,7 +406,10 @@ func (t *Tile) Draw(boardImage *ebiten.Image) { str := strconv.Itoa(v) f := mplusBigFont - if 2 < len(str) { + switch { + case 3 < len(str): + f = mplusSmallFont + case 2 < len(str): f = mplusNormalFont } diff --git a/examples/2048/main.go b/examples/2048/main.go index c2cd7fd4d..47f214225 100644 --- a/examples/2048/main.go +++ b/examples/2048/main.go @@ -44,7 +44,7 @@ func main() { if err != nil { log.Fatal(err) } - if err := ebiten.Run(update, twenty48.ScreenWidth, twenty48.ScreenHeight, 2, "2048 (Ebiten Demo)"); err != nil { + if err := ebiten.Run(update, twenty48.ScreenWidth, twenty48.ScreenHeight, 1, "2048 (Ebiten Demo)"); err != nil { log.Fatal(err) } }