fixed welcome layout and position

This commit is contained in:
2024-02-17 19:28:56 +01:00
parent 3069d77189
commit 87a15ba74e
3 changed files with 111 additions and 22 deletions

View File

@@ -11,13 +11,17 @@ import (
var FontRenderer = LoadFonts("fonts")
const (
GameFont string = "x12y20pxScanLine"
FontSize int = 16
GameFont string = "x12y20pxScanLine"
FontSizeNormal int = 16
FontSizeBig int = 48
FontSizeSmall int = 8
)
type Texter struct {
Renderer *etxt.Renderer
Font *font.Face
Renderer *etxt.Renderer
FontNormal *font.Face
FontBig *font.Face
FontSmall *font.Face
}
func LoadFonts(dir string) *Texter {
@@ -32,7 +36,19 @@ func LoadFonts(dir string) *Texter {
}
gameface := truetype.NewFace(gamefont, &truetype.Options{
Size: float64(FontSize),
Size: float64(FontSizeNormal),
DPI: 72,
Hinting: font.HintingFull,
})
biggameface := truetype.NewFace(gamefont, &truetype.Options{
Size: float64(FontSizeBig),
DPI: 72,
Hinting: font.HintingFull,
})
smallgameface := truetype.NewFace(gamefont, &truetype.Options{
Size: float64(FontSizeSmall),
DPI: 72,
Hinting: font.HintingFull,
})
@@ -58,7 +74,7 @@ func LoadFonts(dir string) *Texter {
renderer.SetCacheHandler(glyphsCache.NewHandler())
renderer.SetFont(fontlib.GetFont(GameFont))
return &Texter{Renderer: renderer, Font: &gameface}
return &Texter{Renderer: renderer, FontNormal: &gameface, FontBig: &biggameface, FontSmall: &smallgameface}
}
// helper function used with FontLibrary.EachFont to make sure