draw constellation lines with braille characters#98
draw constellation lines with braille characters#98rumly111 wants to merge 1 commit intoda-luce:mainfrom
Conversation
|
This looks great! Have only done a brief skim so far but in about two weeks I'll have some more free time and will work to get this in :) |
| } | ||
|
|
||
| #define MAX_COLS 1024 | ||
| #define MAX_ROWS 1024 |
There was a problem hiding this comment.
Just skimming, but on large terminals, would a buff overflow be possible here?
Since we're always rendering constant number of constellation lines each frame, it might be safer to dynamically allocate a buffer based on the current terminal size. Doing that each frame might be expensive but then again I'm not sure without bench marking
There was a problem hiding this comment.
well that's what google gpt recommended me for safe big numbers :) Even with font size 10 px you need 10000x10000 display resolution, which is way above 4k monitors. dynamic allocation just complicates things.
| .aspect_ratio = 0.0, | ||
| .quit_on_any = false, | ||
| .unicode = false, | ||
| .braille = false, |
There was a problem hiding this comment.
Thinking about how the flags will work here; technically enabling braille is displaying some unicode characters, which one might expect to find under the unicode flag.
I think a better solution for the future will be to have distinct flags for different element styles, e.g.:
- Constellation style: ASCII, smooth, braille
- Star style: ASCII, circle, braille
Seems out of scope for this PR, just noting to self.
There was a problem hiding this comment.
hmm, I just wanted something to work, so didn't bother with args logic. for example if I set --braille, it could automatically enables --unicode etc, but the user should think of it himself. anyway, your idea of having a separate "braille" rendering mode is not bad, and here is a library for C that works with "braille graphics" : https://github.com/Huulivoide/libdrawille . I looked at the bresenham line drawing algorithm there.

Using braille characters we can basically split each terminal cell to 2x8 "subpixels", and use those "dots" to draw lines etc.
Added param --braille (--unicode is also needed), here is the result:
