2023-08-31 17:05:53 -04:00
|
|
|
package splashmenu
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"log"
|
|
|
|
|
|
|
|
|
|
"github.com/hajimehoshi/ebiten/v2/examples/resources/fonts"
|
|
|
|
|
"golang.org/x/image/font"
|
|
|
|
|
"golang.org/x/image/font/opentype"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type FontBase struct {
|
2023-09-05 07:50:59 -04:00
|
|
|
Title font.Face
|
|
|
|
|
Menu font.Face
|
|
|
|
|
Splash font.Face
|
|
|
|
|
BigTitle font.Face
|
|
|
|
|
MegaTitle font.Face
|
2023-08-31 17:05:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
SplashFont *FontBase
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
|
|
|
|
const dpi = 72
|
|
|
|
|
SplashFont = &FontBase{}
|
|
|
|
|
|
|
|
|
|
tt, err := opentype.Parse(fonts.PressStart2P_ttf)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SplashFont.Title, err = opentype.NewFace(tt, &opentype.FaceOptions{
|
|
|
|
|
Size: 16,
|
|
|
|
|
DPI: dpi,
|
|
|
|
|
Hinting: font.HintingVertical,
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SplashFont.Menu, err = opentype.NewFace(tt, &opentype.FaceOptions{
|
|
|
|
|
Size: 10,
|
|
|
|
|
DPI: dpi,
|
|
|
|
|
Hinting: font.HintingVertical,
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
tt, err = opentype.Parse(fonts.PressStart2P_ttf)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SplashFont.Splash, err = opentype.NewFace(tt, &opentype.FaceOptions{
|
|
|
|
|
Size: 12,
|
|
|
|
|
DPI: dpi,
|
|
|
|
|
Hinting: font.HintingVertical,
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SplashFont.BigTitle, err = opentype.NewFace(tt, &opentype.FaceOptions{
|
|
|
|
|
Size: 40,
|
|
|
|
|
DPI: dpi,
|
|
|
|
|
Hinting: font.HintingVertical,
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-05 07:50:59 -04:00
|
|
|
SplashFont.MegaTitle, err = opentype.NewFace(tt, &opentype.FaceOptions{
|
|
|
|
|
Size: 70,
|
|
|
|
|
DPI: dpi,
|
|
|
|
|
Hinting: font.HintingVertical,
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-31 17:05:53 -04:00
|
|
|
}
|