ebiten: convert view-menu
This commit is contained in:
@@ -3,35 +3,21 @@ package conv
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/faiface/pixel"
|
||||
"github.com/faiface/pixel/text"
|
||||
"golang.org/x/image/colornames"
|
||||
"golang.org/x/image/font/basicfont"
|
||||
|
||||
"ur.gs/ordoor/internal/fonts"
|
||||
)
|
||||
|
||||
type Font struct {
|
||||
Name string
|
||||
Atlas *text.Atlas
|
||||
Text *text.Text
|
||||
}
|
||||
|
||||
func (f *Font) Output(to pixel.Target, m pixel.Matrix, format string, args ...interface{}) {
|
||||
text := text.New(pixel.V(0.0, 0.0), f.Atlas)
|
||||
text.Color = colornames.White
|
||||
func (f *Font) Output(to interface{}, m interface{}, format string, args ...interface{}) {
|
||||
|
||||
fmt.Fprintf(text, format, args...)
|
||||
// FIXME: actually output some text onto screen
|
||||
|
||||
text.Draw(to, m)
|
||||
fmt.Printf(format+"\n", args...)
|
||||
}
|
||||
|
||||
func ConvertFont(font *fonts.Font) *Font {
|
||||
// FIXME: actually use the pixel data in font
|
||||
atlas := text.NewAtlas(basicfont.Face7x13, text.ASCII)
|
||||
|
||||
return &Font{
|
||||
Name: font.Name,
|
||||
Atlas: atlas,
|
||||
}
|
||||
return &Font{Name: font.Name}
|
||||
}
|
||||
|
Reference in New Issue
Block a user