This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
AssossaGPB's profile picture

Recording the screen

Started by AssossaGPB, 25 November 2014 - 05:08 PM
AssossaGPB #1
Posted 25 November 2014 - 06:08 PM
Hello everyone,
I was thinking about making a remote control computer program, but i realized I would need to "record" the screen to do that. I have looked through the source of Jrecord and lightshot, but it baffles me. I really do not understand how this works. One way I know how to do it is just overwrite every single function in all the apis and replace them with functions that record the call and then call the original function. That would make sense, but it seems like a lot of work and the recorder programs already out there seems to do something different and more efficient.

Please help me understand how this works,
Thanks!
KingofGamesYami #2
Posted 25 November 2014 - 06:15 PM
You are wanting to record everything on a CC screen, yes? All you need to do is overwrite the term.setTextColor, term.setBackgroundColor, and term.write functions. Other than that, you could make a custom window object similar to a buffer that remembers everything passed to it.
AssossaGPB #3
Posted 25 November 2014 - 06:37 PM
Ok, how exactly does a buffer work?
KingofGamesYami #4
Posted 25 November 2014 - 06:43 PM
A buffer is a table with every term/window function defined in it. However, in stead of them actually doing what they are supposed to (eg. writing to the screen), they save the content to an internal table. Then, when you tell the buffer to update, it draws the contents of it's table on the screen. The more efficient ones even keep track of what needs to be written, and minimize the number of times they must change a color.
Bomb Bloke #5
Posted 26 November 2014 - 12:55 AM
Er, sorta. In the case you describe the buffer would be the table storing the screen content, utilised by the custom term API. You might call the combined product a "buffering display API", but the API itself is not the buffer.

Generally speaking, a buffer is just somewhere you stick data for later use.
KingofGamesYami #6
Posted 26 November 2014 - 01:35 AM
Well, he asked how one worked, so I assumed that was probably what he wanted.
Luca_S #7
Posted 22 December 2014 - 07:13 PM
You are wanting to record everything on a CC screen, yes? All you need to do is overwrite the term.setTextColor, term.setBackgroundColor, and term.write functions. Other than that, you could make a custom window object similar to a buffer that remembers everything passed to it.
whats with the cursor pos?
Lignum #8
Posted 22 December 2014 - 09:42 PM

It doesn't need to be overwritten because we already have term.getCursorPos().