diff options
| author | DrNuget <drnuget@outlook.com> | 2025-10-30 09:08:41 +0200 |
|---|---|---|
| committer | DrNuget <drnuget@outlook.com> | 2025-10-30 09:08:41 +0200 |
| commit | 238d341c328075454b6b82dc8348a335dc04254d (patch) | |
| tree | 788703f4ca3e59865cc2f82e94475e158cf4e64c | |
| parent | 14bea573767bfe37d536929c16dedceb06bbd5cf (diff) | |
| download | brailleboi-238d341c328075454b6b82dc8348a335dc04254d.tar.gz | |
some broken stuff, will fix later
| -rw-r--r-- | brailleboi.c | 20 | ||||
| -rw-r--r-- | brailleboi.h | 4 |
2 files changed, 24 insertions, 0 deletions
diff --git a/brailleboi.c b/brailleboi.c index e04d17c..9bc6b8b 100644 --- a/brailleboi.c +++ b/brailleboi.c @@ -22,6 +22,7 @@ int brailleStop(image_buffer* buf) int brailleReorganizeBits(int old) { + //Reorganizes bits because the unicode standard for 8 dotted braille is weird int new = (old&0b10000111) | (old&0b01110000)>>1 | (old&0b00001000)<<3; @@ -32,3 +33,22 @@ void braillePrint(int data) { wprintf(L"%lc", (0x2800|data)); } + +int braillePlot(int x, int y, image_buffer* buf) +{ + //Check if plot is within bounds + if (x>buf->width | y>buf->height) + return 1; + buf->contents[y * buf->width + x] |= 1<<((1+x%2)*y); + return 0; +} + +void brailleUpdateScreen(image_buffer* buf) +{ + for (int x=0;x<buf->width;x++) { + for (int y=0;y<buf->height;y++) { + printf("\e[%d;%dH", y, x); + braillePrint(buf->contents[y * buf->width + x]); + } + } +} diff --git a/brailleboi.h b/brailleboi.h index f909181..1138e09 100644 --- a/brailleboi.h +++ b/brailleboi.h @@ -14,4 +14,8 @@ int brailleReorganizeBits(int old); void braillePrint(int data); +int braillePlot(int x, int y, image_buffer* buf); + +void brailleUpdateScreen(image_buffer* buf); + #endif |
