You can set a char on the screen, but you can’t ask the terminal about it. An LCD driver is only capable of setting a pixel it can't read from it. You can’t physically ask the LCD driver to tell you what color pixel 1337x1337 is. From there, you send the image to the screen. This means that to display an image on the screen, you need to first draw it in memory. This works in the same way a computer screen does: it works from what’s in memory, and not how the pixel is set. You could with a FPGA, but that's a topic for a different time. There is no way to instantly show a full image on the screen or take everything in one go (camera sensor). Side Note: This is also how regular screens work, but not limited to camera sensors, LED Matrix, etc. Meaning that you move the cursor to a position, print out that char, move the cursor to the next position, draw a char, etc. Here's another important concept to understand: Drawing on the screen happens one character at a time. Those assumptions were causing me to think about this topic in the wrong way. It took me a while to understand how the terminal window works and change my assumptions about it. But if there's stuff on the screen that you would like to get to, you can’t.Īnd this is an important piece of information that nobody talks about or cares to explain (maybe it is obvious, but it wasn't for me in the beginning). You only have access to what comes from the user input. You can’t even read what's on the screen. You might think that it’s because someone doesn’t care about this module, but the reality is that there isn’t much to do in a terminal window.īasically, you can only move the cursor on the X or Y axis, and you can only print a character (or set of characters) from the position of the cursor. This will give us a frame of reference to understand how to go about it, and then better understand the example code in the repo.įor starters, " Readline" is the NodeJS module that allows you to manipulate the screen. Yes, I'm very excited about the terminal window! □Īnd these are the terminal libraries make me blush: ☺️īefore we get into coding, we need to understand the idea of drawing on a terminal window. They were made by some amazing people, and they empower developers to do some wild things. I also hope to help you gain an appreciation for all of the wonderful libraries out there. Also, I'll share what I'm learning, so we can learn together as we go. In this article, I'll explore the process of learning how to do that. How to manipulate the terminal window in NodeJS - Readlineĭrawing on the terminal window using ASCII characters has always fascinated me.
0 Comments
Leave a Reply. |