diff options
Diffstat (limited to 'src/strings33.c')
-rw-r--r-- | src/strings33.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/strings33.c b/src/strings33.c index 0bb7ea0..8613c02 100644 --- a/src/strings33.c +++ b/src/strings33.c @@ -14,6 +14,18 @@ static Font33 *fonts[2] = { }; +static u32 textColours[9] = { + 0xff000000, + 0xffffffff, + 0xffff0000, + 0xff00ff00, + 0xff0000ff, + 0xffffff00, + 0xff00ffff, + 0xffff00ff, + 0xffffaa00, +}; + void e33_uprintf( Surface *surf, Size f, u32 col, Size x, Size y, const char *fmt, ... ) { @@ -43,6 +55,7 @@ void e33_uprint( Surface *surf, Size f, u32 col, Size x, Size y, const char *str Size strWid = 0; for( i = 0; i < slen; ++i ) { + if( str[i] < 0x20 ) continue; strWid += glyphs[ str[i] - 0x20 ].width; } @@ -59,6 +72,12 @@ void e33_uprint( Surface *surf, Size f, u32 col, Size x, Size y, const char *str for( i = 0, ofs = 0; i < slen; ++i ) { + if( str[i] < 0x20 ) + { + col = textColours[str[i]]; + continue; + } + FontGlyph33 *glyph = &glyphs[ str[i] - 0x20 ]; Size numPlots = glyph->num_plots; Size gWidth = glyph->width; |