diff options
author | pk33 <pk33@pk33.space> | 2024-11-04 21:42:06 +0100 |
---|---|---|
committer | pk33 <pk33@pk33.space> | 2024-11-04 21:42:06 +0100 |
commit | 146a683b8d8315ef15dc1c9286f0983834f48d88 (patch) | |
tree | 44124fbaf1d49c25de8422ed29c7bade0bc11963 /src/strings33.c | |
parent | 0ffb4f8463e3e06e8d88b7be22f5cb7adb702361 (diff) | |
download | engine33-146a683b8d8315ef15dc1c9286f0983834f48d88.tar.gz |
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; |