02-22-2005, 02:02 AM
Wanted to inform you of three important changes I did in gfxlib, that will be released with FB 0.12:
- The lib now uses MMX color blitters to keep the screen updated, so it'll be faster than before
- Also thanks to help by v1c, GET and PUT now fully support pointers, so the following source works great:Code:
SUB Redraw(title AS STRING)
CLS
LINE (0,0)-(319,199), 4
LINE (0,199)-(319,0), 2
PRINT title
END SUB
TYPE FB_IMAGE field = 1
width AS USHORT
height AS USHORT
imageData(64000) AS UBYTE
END TYPE
DIM udt AS FB_IMAGE
DIM udt_ptr AS FB_IMAGE PTR
DIM array(16001) AS INTEGER
DIM array_ptr AS INTEGER PTR
SCREEN 13
udt_ptr = @udt
array_ptr = @array(0)
Redraw "array": CLEAR array(0),,64004
GET (0,0)-(319,199), array
CLS: PUT (0,0), array, PSET: WHILE INKEY$ = "": WEND
Redraw "array(0)": CLEAR array(0),,64004
GET (0,0)-(319,199), array(0)
CLS: PUT (0,0), array, PSET: WHILE INKEY$ = "": WEND
Redraw "@array[0]": CLEAR array(0),,64004
GET (0,0)-(319,199), @array(0)
CLS: PUT (0,0), array, PSET: WHILE INKEY$ = "": WEND
Redraw "array_ptr": CLEAR array(0),,64004
GET (0,0)-(319,199), array_ptr
CLS: PUT (0,0), array, PSET: WHILE INKEY$ = "": WEND
Redraw "@array_ptr[0]": CLEAR array(0),,64004
GET (0,0)-(319,199), @array_ptr[0]
CLS: PUT (0,0), array, PSET: WHILE INKEY$ = "": WEND
Redraw "@udt": CLEAR udt,, 64004
GET (0,0)-(319,199), @udt
CLS: PUT (0,0), @udt, PSET: WHILE INKEY$ = "": WEND
Redraw "udt_ptr": CLEAR udt,,64004
GET (0,0)-(319,199), udt_ptr
CLS: PUT (0,0), @udt, PSET: WHILE INKEY$ = "": WEND
Redraw "@udt_ptr[0]": CLEAR udt,,64004
GET (0,0)-(319,199), @udt_ptr[0]
CLS: PUT (0,0), @udt, PSET: WHILE INKEY$ = "": WEND - All primitives, including GET and PUT, now support drawing on GET/PUT buffers; you just have to pass the buffer as first argument to all primitives (it's optional; omitting it will make them draw to the current work page as usual). So you can do things like:When drawing into a buffer, the coordinates are affected by last call to WINDOW, but the clipping region will be forced to be the whole buffer area despite the most recent call to VIEW. Of course the target buffer parameter can be an array or a pointer, as for the GET/PUT data parameter.Code:
DIM buffer(64004) AS BYTE
GET (0,0)-(319,199), buffer
PSET buffer, (0,0), 15
LINE buffer, (0,0)-(319,199), 2
PUT buffer, (0,0), sprite, TRANS
ngelo Mottola - EC++