Qbasicnews.com

Full Version: PUTting to a buffer
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do I use the PUT command to draw a sprite in an off-screen buffer (virtual screen, whatever)?
Quote:How do I use the PUT command to draw a sprite in an off-screen buffer (virtual screen, whatever)?

examples/gfx/rel-sprites.bas :bounce:

v13b is aviable

Joshy
I already saw that example, but it doesn't use the PUT command. I already know how to plot 1 pixel at a time. I was looking for a built-in sub. Oh well.
Gfx commands like PSET and PUT can draw to GET/PUT buffers. I forget the syntax - but I'm sure that was added recently.

EDIT: Yep, it's in docs/gfxlib.txt.
PUT [buffer,][STEP](x,y), arrayname[(idx)] [,mode]
And buffer would be a GET/PUT format array.

Or you can still do QB-style page flipping with the SCREENSET command, if that's what you mean by off-screen buffer.
Quote:Gfx commands like PSET and PUT can draw to GET/PUT buffers. I forget the syntax - but I'm sure that was added recently.

EDIT: Yep, it's in docs/gfxlib.txt.
PUT [buffer,][STEP](x,y), arrayname[(idx)] [,mode]
And buffer would be a GET/PUT format array.

Or you can still do QB-style page flipping with the SCREENSET command, if that's what you mean by off-screen buffer.

I tried that PUT syntax, but it didn't seem to work... Maybe because of tiny_ptc or sdl?
nop gfx lib is directX or GDI it all low level stuff thanks to the geniuse that is lillo.
The buffer needs to be a valid GET/PUT buffer before you can use any primitive (including PUT) on it.
Code:
DIM buffer(64004) AS UBYTE
SCREEN 13

GET(0,0)-(319,199),buffer

'' suppose you have a valid "sprite" array holding your sprite (also in GET/PUT format)
PUT buffer, (0,0), sprite
You can also request to SCREEN any number of offscreen pages. A page is the same size as the visible screen, and at any time you can work on a page while displaying another one.
Use SCREENSET/SCREENCOPY to deal with this; have a look at docs/gfxlib.txt for details.
Quote:The buffer needs to be a valid GET/PUT buffer before you can use any primitive (including PUT) on it.

Ohhhhhh...! Big Grin I didn't know that. Thanks.