@@ -15,6 +15,24 @@ import (
1515 "github.com/elgopher/pi/vm"
1616)
1717
18+ // Print prints text on the screen using system font. It takes into consideration
19+ // clipping region and camera position.
20+ //
21+ // Only unicode characters with code < 256 are supported. Unsupported chars
22+ // are printed as question mark. The entire table of available chars can be
23+ // found here: https://github.com/elgopher/pi/blob/master/internal/system-font.png
24+ //
25+ // Print returns the right-most x position that occurred while printing.
26+ func Print (text string , x , y int , color byte ) (rightMostX int ) {
27+ return Font (vm .SystemFont ).Print (text , x , y , color )
28+ }
29+
30+ // PrintCustom prints text in the same way as Print, but using custom font.
31+ func PrintCustom (text string , x , y int , color byte ) (rightMostX int ) {
32+ // FIXME Probably escape character should be used to switch the font instead
33+ return Font (vm .CustomFont ).Print (text , x , y , color )
34+ }
35+
1836//go:embed internal/system-font.png
1937var systemFontPNG []byte
2038
@@ -115,21 +133,3 @@ func loadCustomFont(resources fs.ReadFileFS) error {
115133
116134 return LoadFontData (fileContents , vm .CustomFont .Data [:])
117135}
118-
119- // Print prints text on the screen using system font. It takes into consideration
120- // clipping region and camera position.
121- //
122- // Only unicode characters with code < 256 are supported. Unsupported chars
123- // are printed as question mark. The entire table of available chars can be
124- // found here: https://github.com/elgopher/pi/blob/master/internal/system-font.png
125- //
126- // Print returns the right-most x position that occurred while printing.
127- func Print (text string , x , y int , color byte ) (rightMostX int ) {
128- return Font (vm .SystemFont ).Print (text , x , y , color )
129- }
130-
131- // PrintCustom prints text in the same way as Print, but using custom font.
132- func PrintCustom (text string , x , y int , color byte ) (rightMostX int ) {
133- // FIXME Probably escape character should be used to switch the font instead
134- return Font (vm .CustomFont ).Print (text , x , y , color )
135- }
0 commit comments