Example #1
0
func NewFont(_file string, _size int) *PU_Font {
	sdlfont := sdl.LoadFont(_file, _size)
	if sdlfont == nil {
		fmt.Printf("Error loading Font: %v", sdl.GetError())
	}
	f := &PU_Font{font: sdlfont,
		fontmap: make(map[uint32]map[uint16]*PU_Image),
		color:   &sdl.Color{255, 255, 255, 255},
		alpha:   255,
		size:    _size}
	f.Build()
	return f
}
Example #2
0
//Load font from file and specify font size (each font-size needs a seperate font instance)
func NewFont(_file string, _size int) *Font {
	sdlfont := sdl.LoadFont(_file, _size)
	if sdlfont == nil {
		fmt.Printf("Go2D Error: Loading Font: %v", sdl.GetError())
	}
	f := &Font{font: sdlfont,
		fontmap: make(map[uint32]map[uint16]*Image),
		color:   &sdl.Color{255, 255, 255, 255},
		alpha:   255,
		size:    _size}
	addResource(f)
	f.build()
	return f
}