you can use this code
Code: Select all
;************************
;LoadSprite3D with and without Alphablending
;Thanks to Ollivier, Case and Cpl.Bator (french forum)
;source : http://www.purebasic.fr/french/viewtopic.php?p=97059#97059
;************************
Procedure LoadSprite3DAlphaAuto(NoSprite.l,Filename.s,Option.l)
If LCase(GetExtensionPart(Filename.s))="png" And ReadFile(0, Filename.s )
FileSeek(0, 25)
If ReadByte(0) = 6
Debug "alpha layer"
Option.l=Option|#PB_Sprite_AlphaBlending;
EndIf
CloseFile(0)
EndIf
If LoadSprite(NoSprite,Filename,Option) and CreateSprite3D(NoSprite,NoSprite)
ProcedureReturn #True
Else
ProcedureReturn #False
Endif
EndProcedure