I am trying to load and display a simple sprite, but the LoadSprite() function always returns 0. Can anyone tell me what I'm doing wrong?
Code: Select all
;init code
InitSprite()
InitKeyboard()
UseJPEGImageDecoder()
UseJPEGImageEncoder()
UseJPEG2000ImageDecoder()
UseJPEG2000ImageEncoder()
;data section, binary includes
;DataSection
; IncludeBinary "stick_figure.JPG"
;EndDataSection
;globals
Global x
Global y
;additional setup, load sprites
OpenScreen(800,600,16,"",#PB_Screen_SmartSynchronization)
stick = LoadSprite(#PB_Any,"stick_figure.JPG")
If stick=0
MessageRequester("Error","Unable to load sprite")
End
EndIf
ExamineKeyboard()
;main loop
While KeyboardInkey()<>Chr(27)
ExamineKeyboard()
StartDrawing(ScreenOutput())
DisplaySprite(stick,x,y)
StopDrawing()
FlipBuffers()
Wend
Thanks for any info.


