aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrNuget <drnuget@outlook.com>2025-11-02 01:35:40 +0200
committerDrNuget <drnuget@outlook.com>2025-11-02 01:35:40 +0200
commitc0b5e476f5cf98fae12d2b4c80ae9d907669f1e2 (patch)
tree95207ea528182c5b22615a3a70906a3846f3c5cc
parentdb2e43856b5dc9473a6311e3cc60f2645172ac3f (diff)
downloadbrailleboi-c0b5e476f5cf98fae12d2b4c80ae9d907669f1e2.tar.gz
fix plotting to right coordinates
-rw-r--r--brailleboi.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/brailleboi.c b/brailleboi.c
index e47ca8b..58fecce 100644
--- a/brailleboi.c
+++ b/brailleboi.c
@@ -40,9 +40,7 @@ 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-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]);
+ buf->contents[(y-1)/4 * buf->width + (x-1)/2] |= 1<<(y-1)%4+(1-x%2)*4;
return 0;
}
@@ -50,7 +48,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);
+ wprintf(L"\e[%d;%dH", y+1, x+1);
braillePrint(brailleReorganizeBits(buf->contents[y * buf->width + x]));
}
}