DECLARE SUB DQBrPut (BYVAL Layer, BYVAL x, BYVAL y, BYVAL SpriteSeg,
BYVAL SpriteOff, BYVAL Angle, BYVAL Zoom)
Layer - Layer where to draw the sprite
x - X position of upper left corner of the sprite
y - Y position of upper left corner of the sprite
SpriteSeg - Segment of the array holding the sprite data; use VARSEG
SpriteOff - Offset of the array holding the sprite data; use VARPTR
Angle - Rotation angle ranging 0-255
Zoom - Zoom factor
none
DQBrPut draws a sprite rotated and scaled of the specified values. The angle can range from 0 to 255 (256=0), while the zoom factor represents the zooming percentage: a value of 100 will draw the sprite in its original size, a value of 50 will draw a sprite of half its original size, etc... The rotation uses a pixel-perfect algorithm, but rotated pixels that lie outside the original sprite mask will not be drawn; this means that if you want to rotate a sprite without loosing graphics, you must get it into a bigger area. For example, let's suppose you have a 16x16 pixels sprite: you should get an area of 22x22 pixels to be sure not to loose any pixel when rotating. The same goes when zooming in: the original sprite area is respected.
*****************************************************************************
' All integers for speed
DEFINT A-Z
'$INCLUDE: 'DIRECTQB.BI'
' Let's initialize the library with one extra layer and no sounds nor EMS
IF DQBinit(1, 0, 0) THEN DQBclose: PRINT DQBerror$: END
' Let's use an 80x80 pixels sprite
Size = DQBsize(0, 0, 79, 79)
' Our array is made of INTEGERs, so we divide Size by 2
DIM Sprite(Size \ 2)
' Let's prepare our sprite
DQBclearLayer 1
DQBprint 1, "DirectQB!", 8, 36, 40
DQBget 1, 0, 0, 79, 79, VARSEG(Sprite(0)), VARPTR(Sprite(0))
DQBinitVGA
FOR i = 0 TO 90
' Empties layer 1
DQBclearLayer 1
' Draws our roto-zoomed sprite into layer 1
DQBrPut 1, 120, 60, VARSEG(Sprite(0)), VARPTR(Sprite(0)), (90 - i), (10 + i)
' Waits for vertical retrace 1 time
DQBwait 1
' Copies layer 1 onto the screen
DQBcopyLayer 1, VIDEO
NEXT i
' Ends program
DQBclose
*****************************************************************************