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

Side menu that pulls out

Started by Dave-ee Jones, 15 August 2017 - 04:23 AM
Dave-ee Jones #1
Posted 15 August 2017 - 06:23 AM
So you know those menus that slide out when you click an arrow, showing a side menu or side bar information? I would like to put that on my remote control program but there is a small problem…

How do I get it to redraw what was there before the sidebar menu was opened? E.g. I open the sidebar menu and it overlays what's currently on the screen, then I close the menu and the whole screen is just blanked because I had to clear it to close the menu (or just that part of the screen if you clear those specific pixels). How do I get it to overlay, then redraw what was there?

I don't want to do the "remember what was called last" because that's just dodgy. Buffers are kind of an option, but I've never used them before and don't plan on starting anytime soon.

Can anyone share some advice?
Lyqyd #2
Posted 15 August 2017 - 06:32 AM
Buffer the content, then redraw it when you collapse the menu. It's the correct way to do this.
Dave-ee Jones #3
Posted 15 August 2017 - 06:58 AM
Buffer the content, then redraw it when you collapse the menu. It's the correct way to do this.

Okay, so, how do you buffer it? :P/>

Does it just catch what was drawn and where it was drawn and then goes through all those functions again? As I said in the first post I've never used it before and never really understood it.
Bomb Bloke #4
Posted 15 August 2017 - 09:38 AM
The "simple" way to do it, and indeed likely the most practical way for your purposes, is to use CC's included buffering API. Use it to create a terminal object, use that the draw stuff that you later want to "recall", then call buffer.redraw() whenever you want that content brought back to the "front" of your screen.
Dave-ee Jones #5
Posted 16 August 2017 - 02:45 AM
The "simple" way to do it, and indeed likely the most practical way for your purposes, is to use CC's included buffering API. Use it to create a terminal object, use that the draw stuff that you later want to "recall", then call buffer.redraw() whenever you want that content brought back to the "front" of your screen.

Ah, that sounds like the way to go. I'll try figure it out from here, thanks for the help :)/>