diff options
| author | DrNuget <drnuget@outlook.com> | 2025-11-01 18:39:47 +0200 |
|---|---|---|
| committer | DrNuget <drnuget@outlook.com> | 2025-11-01 18:39:47 +0200 |
| commit | db2e43856b5dc9473a6311e3cc60f2645172ac3f (patch) | |
| tree | 810e15c9050af70aa56dd89083dff71d5d6bc870 /brailleboi.c | |
| parent | 1e07325fed7f3e5b0354a977da0fc1739c0b2a3c (diff) | |
| download | brailleboi-db2e43856b5dc9473a6311e3cc60f2645172ac3f.tar.gz | |
fix the math formula for bit shifting
Diffstat (limited to 'brailleboi.c')
| -rw-r--r-- | brailleboi.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/brailleboi.c b/brailleboi.c index d8ff8e9..e47ca8b 100644 --- a/brailleboi.c +++ b/brailleboi.c @@ -40,7 +40,8 @@ int braillePlot(int x, int y, image_buffer* buf) //TODO: fix boundary check // if (x>buf->width | y>buf->height) // return 1; - buf->contents[y/4 * buf->width + x/2] |= 128>>y%4+x%2*4; + buf->contents[y/4 * buf->width + x/2] |= 128>>(y-1)%4+(x%2)*4; +// buf->contents[y/4 * buf->width + x/2] |= 128>>; //printf("%#08x\n", buf->contents[y/4 * buf->width + x/2]); return 0; } @@ -50,7 +51,7 @@ void brailleUpdateScreen(image_buffer* buf) for (int x=0;x<buf->width;x++) { for (int y=0;y<buf->height;y++) { wprintf(L"\e[%d;%dH", y, x); - braillePrint(buf->contents[y * buf->width + x]); + braillePrint(brailleReorganizeBits(buf->contents[y * buf->width + x])); } } } |
