Fix 1-bit bitmap rendering and add player turn modal

This commit is contained in:
Adolfo Reyna
2026-02-02 23:14:11 -05:00
parent d5a80235b4
commit 3bdbfb1811
3 changed files with 72 additions and 4 deletions

View File

@@ -484,11 +484,11 @@ void LowLevelRenderer::draw_arc(int center_x, int center_y, int radius, int star
void LowLevelRenderer::draw_bitmap(const unsigned char* bitmap, int x, int y, int width, int height, bool invert)
{
int byteWidth = (width + 7) / 8; // Bitmaps are typically padded to the next full byte for each row
for (int py = 0; py < height; ++py) {
for (int px = 0; px < width; ++px) {
int bit_index = py * width + px;
int byte_index = bit_index / 8;
int bit_offset = 7 - (bit_index % 8); // MSB first
int byte_index = py * byteWidth + (px / 8);
int bit_offset = 7 - (px % 8); // MSB first
bool pixel_on = (bitmap[byte_index] & (1 << bit_offset)) != 0;
if (invert) {
pixel_on = !pixel_on;