Re: [wxEuphoria] making a "virtual window"

new topic     » goto parent     » topic index » view thread      » older message » newer message
DanM said...

I'm trying to modify the demo "text-on-window" such that ALL the text would be written to a "virtual window" first; that way, the arrow-keys, instead of constantly re-writing portions of text from the read-in file to the window, could make relevant portions of the virtual window be blitted to the real window, so as to have a moving "view-port".

First, I moved the "TextFrame = create( wxFrame..." up higher in the demo (just so I could see it better), which worked ok, and then added "canvasBMP = create( wxBitmap, {BM_IN_MEMORY, ScrnDim[1], ScrnDim[2]})," with the intent to write the text TO that bitmap.

But should I also create a "wxMemoryDC", as in "trans_blit.exw" demo?

Yes. The wxMemoryDC is what you'll need to use to pass to any routine asking for a DC (wx_puts(), etc).

DanM said...

And can I CHANGE the virtual window's size via "set_size" after the text file is loaded & length/height can be determined, so it can hold all the text?

No. The bitmap isn't actually a window. If you need something bigger, then you should delete the old one and its wxMemoryDC (to prevent memory leaks) and create a new, bigger bitmap.

Having said all that, I'd recommend taking a look at the text-on-window.exw demo. It's really just a port of a similar Win32Lib demo that allows you to scroll around the source of the demo. It draws directly to the screen, and generally seems pretty snappy. Are you sure you need to have the entire thing in there?

Note that I'm not arguing against double buffering, since that is useful to reduce flicker. I'm just wondering if you're going to a lot of effort for little effect.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu