dialog skeleton

This commit is contained in:
2023-07-04 19:36:40 +02:00
parent 7874fc022f
commit 1451bd90c0
8 changed files with 162 additions and 51 deletions

View File

@@ -6,9 +6,13 @@ import (
"io/ioutil"
"log"
"image/color"
_ "image/png"
"github.com/hajimehoshi/ebiten"
"github.com/hajimehoshi/ebiten/examples/resources/fonts"
"golang.org/x/image/font"
"golang.org/x/image/font/opentype"
)
func LoadImage(path string) *ebiten.Image {
@@ -30,3 +34,20 @@ func LoadImage(path string) *ebiten.Image {
return out
}
type FontLayout struct {
DPI float64
Size float64
Color color.Color
SelectedColor color.Color
}
func GetFontFace(layout FontLayout) font.Face {
tt, _ := opentype.Parse(fonts.MPlus1pRegular_ttf)
face, _ := opentype.NewFace(tt, &opentype.FaceOptions{
Size: layout.DPI,
DPI: layout.Size,
Hinting: font.HintingVertical,
})
return face
}