Dreamcast: Fix system font rendering

This commit is contained in:
UnknownShadow200 2023-08-12 13:16:09 +10:00
parent 79b1a6720e
commit 1b00b9d7bf
2 changed files with 7 additions and 7 deletions

View File

@ -1065,6 +1065,7 @@ int SysFont_TextWidth(struct DrawTextArgs* args) {
}
return max(1, width);
}
static void DrawSpan(struct Bitmap* bmp, int x, int y, int row, BitmapCol color) {
if (y < 0 || y >= bmp->height) return;
@ -1073,13 +1074,14 @@ static void DrawSpan(struct Bitmap* bmp, int x, int y, int row, BitmapCol color)
int dstX = x + glyphX;
if (dstX < 0 || dstX >= bmp->width) continue;
int bit = BFONT_THIN_WIDTH - glyphX;
if ((row >> bit) & 1) {
// row encodes 12 "1 bit values", starting from hi to lo
if (row & (0x800 >> glyphX)) {
Bitmap_GetPixel(bmp, dstX, y) = color;
}
}
}
static void DrawGlyph(struct Bitmap* bmp, int x, int y, uint8* cell, BitmapCol color) {
// Each font glyph row contains 12 "1 bit" values horizontally
// as 3 bytes = 24 bits, it therefore encodes 2 rows

View File

@ -66,6 +66,7 @@ static void HandleButtons_Launcher(int mods) {
Input_SetNonRepeatable(CCPAD_UP, mods & CONT_DPAD_UP);
Input_SetNonRepeatable(CCPAD_DOWN, mods & CONT_DPAD_DOWN);
}
static void HandleButtons_Game(int mods) {
// TODO CONT_Z
@ -82,11 +83,12 @@ static void HandleButtons_Game(int mods) {
Input_SetNonRepeatable(CCPAD_UP, mods & CONT_DPAD_UP);
Input_SetNonRepeatable(CCPAD_DOWN, mods & CONT_DPAD_DOWN);
}
static void HandleController(cont_state_t* state) {
Input_SetNonRepeatable(CCPAD_L, state->ltrig > 10);
Input_SetNonRepeatable(CCPAD_R, state->rtrig > 10);
// TODO CONT_Z, joysticks
// TODO: verify values are write
// TODO: verify values are right
if (Input.RawMode) {
int dx = state->joyx, dy = state->joyy;
@ -141,10 +143,6 @@ void Window_DrawFramebuffer(Rect2D r) {
// TODO: Don't redraw everything
int size = fb_bmp.width * fb_bmp.height * 4;
cc_uint32* row = Bitmap_GetRow(&fb_bmp, 20);
bfont_draw_str_ex(row, fb_bmp.width, 0xFFEEDDCC, 0x55667788, 32,
true, "ABC III LLL");
// TODO: double buffering ??
// https://dcemulation.org/phpBB/viewtopic.php?t=99999
// https://dcemulation.org/phpBB/viewtopic.php?t=43214