1 module d2dfont
is aliced
;
14 // ////////////////////////////////////////////////////////////////////////// //
15 public __gshared D2DImage
[256] smfont
;
16 //public __gshared D2DImage fftest;
19 public void loadSmFont () {
20 foreach (ubyte cc
; 0..256) {
22 import std
.string
: format
;
23 smfont
[cc
] = new D2DImage("fonts/stcf/stcfnx%02x.vga".format(cc
));
24 smfont
[cc
].createGLTex
;
26 //conwriteln("no char with code ", cc);
29 //fftest = new D2DImage("fonts/stbf/stbf_x61.vga");
30 //fftest = new D2DImage("tilegfx/comp03_1.vga");
35 public void smDrawText (int x
, int y
, const(char)[] str) {
36 foreach (char ch
; str) {
37 if (ch
== ' ') { x
+= 6; continue; }
38 auto img
= smfont
.ptr
[cast(ubyte)ch
];
40 // try uppercase letter
42 img
= smfont
.ptr
[cast(ubyte)ch
];
43 if (img
is null) continue;
45 drawAtXY(img
.tex
, x
-img
.sx
, y
-img
.sy
);