aboutsummaryrefslogtreecommitdiff
path: root/src/brailleboi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/brailleboi.c')
-rw-r--r--src/brailleboi.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/brailleboi.c b/src/brailleboi.c
index fce293a..b914e2d 100644
--- a/src/brailleboi.c
+++ b/src/brailleboi.c
@@ -34,16 +34,6 @@ int brailleReorganizeBits(int old)
return new;
}
-void braillePrint(int data)
-{
- wprintf(L"%lc", (0x2800|data));
-}
-
-void braillePrintCoords(wchar_t *wcs, int len, int data, int x, int y)
-{
- swprintf(wcs, len, L"\033[%d;%dH%lc", x+1, y+1, (0x2800|data));
-}
-
int braillePlot(int x, int y, image_buffer* buf)
{
//Check if plot is within bounds
@@ -61,12 +51,14 @@ void brailleClearBuffer(image_buffer* buf)
void brailleUpdateScreen(image_buffer* buf)
{
wprintf(L"\033[2J");
- int len = (buf->char_width * buf->char_height);
+ int len = (buf->char_width * buf->char_height + buf->char_height);
wchar_t* frame = malloc(len * sizeof(wchar_t));
- for (int x=0;x<buf->char_width;x++) {
- for (int y=0;y<buf->char_height;y++) {
- braillePrintCoords(frame, len, brailleReorganizeBits(buf->contents[y * buf->char_width + x]), x, y);
+ memset(frame, 0, len);
+ for (int y=0;y<buf->char_height;y++) {
+ for (int x=0;x<buf->char_width;x++) {
+ braillePrint(frame, len, brailleReorganizeBits(buf->contents[y * buf->char_width + x]));
}
+ swprintf(frame+wcslen(frame), len, L"\n");
}
wprintf(frame);
free(frame);