;
; ------------------------------------------------------------
;
; PureBasic - Sprite example file
;
; (c) 2002 - Fantaisie Software
;
; ------------------------------------------------------------
;
If InitSprite() = 0 Or InitKeyboard() = 0
MessageRequester("Error", "Sprite system can't be initialized", 0)
End
EndIf
If InitSprite3D() = 0
MessageRequester("Error", "Sprite3D system can't be initialized correctly", 0)
End
EndIf
;
; Now, open a 800*600 - 32 bit screen
;
If OpenScreen(800, 600, 32, "Sprite")
; Load our 16 bit sprite (which is a 24 bit picture in fact, as BMP doesn't support 16 bit format)
;
LoadSprite(0, "Data/Geebee2.bmp", #PB_Sprite_Texture)
CreateSprite3D(0, 0)
CreateSprite3D(1, 0)
CreateSprite3D(2, 0)
Sprite3DQuality(1)
TransparentSpriteColor(0, RGB(255, 0, 255)) ; Our pink is transparent :)
Repeat
; Inverse the buffers (the back become the front (visible)... And we can do the rendering on the back)
FlipBuffers()
ClearScreen(RGB(0,50,128))
; Draw our sprite
;
If Start3D()
DisplaySprite3D(0, 0, 30)
DisplaySprite3D(0, x+100, 100, x)
DisplaySprite3D(0, x*2, 100, x)
; Zoom..
;
ZoomSprite3D(1, x, x)
RotateSprite3D(1, x, 0)
DisplaySprite3D (1, 0, 100, x/2)
DisplaySprite3D (1, x*2, 100, x)
DisplaySprite3D (1, 0, 100, x/2)
DisplaySprite3D (1, x*2, 200+x, x)
Stop3D()
EndIf
ExamineKeyboard()
x+1
Until KeyboardPushed(#PB_Key_Escape)
Else
MessageRequester("Error", "Can't open a 640*480 - 16 bit screen !", 0)
EndIf
End