SpriteControl problems

Blitz3D Forums/Blitz3D Programming/SpriteControl problems

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi Jeroen,

Try this example with the *new* updated SpriteControl.

; GrabImage3D test

tilesX=5 : tilesY=4

; the include file
Include "Sprite Control.bb"

; set up the 3d display
Graphics3D 640,480,0,2
SetBuffer BackBuffer()

img=LoadImage("f:\640x480.jpg")
DrawImage img,0,0

cam=CreateCamera()
piv=CreateSpritePivot(cam,0.0002)

Dim s(1000)

iw=640/tilesX : ih=480/tilesY

For x=0 To (tilesX-1)
For y=0 To (tilesY-1)
	num=num+1
	s(num)=GrabImage3D(x*iw,y*ih,iw,ih)
	HandleImage3D s(num),-1,-1
	DrawImage3D s(num),x*iw,y*ih
Next
Next

RenderWorld

Flip
WaitKey
End


Should be fine now.
To grab the images without the user 'seeing' them do as Sainfohi suggests.
GrabImage3D() works on the current buffer. Just grab your stuff without Flipping and do a cls to clear the buffer.

Example:
; GrabImage3D test2

; the include file
Include "Sprite Control.bb"

; set up the 3d display
Graphics3D 640,480,0,2
SetBuffer BackBuffer()
cam=CreateSpriteCamera()

img=LoadImage("f:\640x480.jpg")
DrawImage img,0,0
sprite=GrabImage3D(20,40,128,128)
Cls

Repeat
	Cls
	DrawImage3D sprite,MouseX(),MouseY()
	RenderWorld
	Flip
Until KeyHit(1)

End