@@ -15,6 +15,24 @@ import (
15
15
"github.com/elgopher/pi/vm"
16
16
)
17
17
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
+
18
36
//go:embed internal/system-font.png
19
37
var systemFontPNG []byte
20
38
@@ -115,21 +133,3 @@ func loadCustomFont(resources fs.ReadFileFS) error {
115
133
116
134
return LoadFontData (fileContents , vm .CustomFont .Data [:])
117
135
}
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