Initial commit.
This commit is contained in:
41
fonts/fonts.go
Normal file
41
fonts/fonts.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package fonts
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"log"
|
||||
|
||||
_ "embed"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2/text/v2"
|
||||
)
|
||||
|
||||
type FontStruct struct {
|
||||
Ducky *text.GoTextFaceSource
|
||||
Karen *text.GoTextFaceSource
|
||||
}
|
||||
|
||||
var (
|
||||
//go:embed bitbybit.ttf
|
||||
bitbybit_ttf []byte
|
||||
//go:embed karenfat.ttf
|
||||
karen_ttf []byte
|
||||
|
||||
DuckyFont FontStruct
|
||||
)
|
||||
|
||||
func init() {
|
||||
DuckyFont = FontStruct{}
|
||||
|
||||
s, err := text.NewGoTextFaceSource(bytes.NewReader(bitbybit_ttf))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
DuckyFont.Ducky = s
|
||||
|
||||
s, err = text.NewGoTextFaceSource(bytes.NewReader(karen_ttf))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
DuckyFont.Karen = s
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user