4 ms·
Fascinating! Are there any easy to follow tutorial on how to manipulate pixel blocks (I wonder what the right term is) inside terminals?
by abhinai 8y ago
Fascinating! Are there any easy to follow tutorial on how to manipulate pixel blocks (I wonder what the right term is) inside terminals?
- AceJohnny2 8y agohttps://www.linuxjournal.com/content/getting-started-ncurses https://www.linuxjournal.com/content/getting-started-ncurses
- the_pwner224 8y agoIf you're referring to the game pieces, the creater probably just used these Unicode characters: https://en.wikipedia.org/wiki/Block_Elements https://en.wikipedia.org/wiki/Block_Elements
- JdeBP 8y agoAs you can see from the program and screenshot right in front of you, xe did not. It's one of only two printw()s in the code, and the screenshot shows the result quite clearly.
- the_pwner224 8y agoYou are correct; the code to print the blocks is on lines 35-37 of tinytetris-commented.c. But the large comment at the top of the tinytetris.c file is made of the block drawing characters :) The attron sets terminal attributes which presumably cause it to flip the " " into a solid block. I haven't decoded what exactly the number it's feeding in represents, but 262176 is 0b1000000000000100000, and the attributes are defined around line 1100 of curses.h on my system (/A_NORMAL will find it).
- TomJansen 8y agothe attron() used is attron(A_REVERSE | COLOR_PAIR(n)). The OR operator is used to combine attributes in curses.