Fix buffered text

This commit is contained in:
Pk11
2021-01-14 10:06:18 -06:00
parent c428fa704b
commit ca9dc8250b
+4 -4
View File
@@ -344,12 +344,12 @@ ITCM_CODE void Font::print(std::u16string_view text, int x, int y, bool top, int
} else { } else {
for(float i = 0.0f; i < tileHeight; i += 1 / scaleY) { for(float i = 0.0f; i < tileHeight; i += 1 / scaleY) {
for(float j = 0.0f; j < tileWidth; j += 1 / scaleX) { for(float j = 0.0f; j < tileWidth; j += 1 / scaleX) {
u8 px = fontTiles[(index * tileSize) + (i * tileWidth + j) / 4] >> u8 px = fontTiles[(index * tileSize) + int(i * tileWidth + j) / 4] >>
((3 - (int(i * tileWidth + j) % 4)) * 2) & ((3 - (int(i * tileWidth + j) % 4)) * 2) &
3; 3;
if(px) if(px)
#ifdef TEXT_BUFFERED #ifdef TEXT_BUFFERED
dst[(y + i) * 256 + j] = px + (color * 4); dst[int((y + i) * 256 + j)] = px + (color * 4);
#else #else
toncset(dst + int((y + i) * 256 + j), px + (color * 4), 1); toncset(dst + int((y + i) * 256 + j), px + (color * 4), 1);
#endif #endif
@@ -364,9 +364,9 @@ ITCM_CODE void Font::print(std::u16string_view text, int x, int y, bool top, int
} }
#ifdef TEXT_BUFFERED #ifdef TEXT_BUFFERED
void Font::clear(bool top) { dmaFillWords(0, FontGraphic::textBuf[top], 256 * 192); } void Font::clear(bool top) { dmaFillWords(0, Font::textBuf[top], 256 * 192); }
void Font::update(bool top) { void Font::update(bool top) {
tonccpy(bgGetGfxPtr(top ? TEXT_TOP_LAYER : TEXT_BOTTOM_LAYER + 4), FontGraphic::textBuf[top], 256 * 192); tonccpy(bgGetGfxPtr(top ? TEXT_TOP_LAYER : TEXT_BOTTOM_LAYER + 4), Font::textBuf[top], 256 * 192);
} }
#endif #endif