aboutsummaryrefslogtreecommitdiff
path: root/brailleboi.c
diff options
context:
space:
mode:
Diffstat (limited to 'brailleboi.c')
-rw-r--r--brailleboi.c20
1 files changed, 20 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]);
+ }
+ }
+}