How comes this code doesn't work (my image doesn't appear) :
UsePNGImageDecoder()
If InitSprite()=0 Or InitKeyboard()=0
MessageRequester("Erreur","DirectX",0)
End
EndIf
ScreenWidth.w=1280
ScreenHeight.w=1024
If OpenScreen(ScreenWidth, ScreenHeight, 32, "Our")=0
MessageRequester("Erreur","Impossible "+Str(ScreenWidth)+","+Str(ScreenHeight))
End
EndIf
SetFrameRate(60)
ImgTile = CatchImage(#PB_Any, ?Background)
ImgBackground = CreateImage(#PB_Any, ScreenWidth, ScreenHeight*2)
StartDrawing(ImageOutput(ImgBackground))
DrawImage(ImgTile, 0, 0)
DrawImage(ImgTile, 0, ScreenHeight)
StopDrawing()
ClearScreen(RGB(50,50,50))
FlipBuffers()
ClearScreen(RGB(50,50,50))
FlipBuffers()
;-----------------------------------------------------------------
; boucle principale
Y = ScreenHeight
Repeat
StartDrawing(ScreenOutput())
DrawImage(ImgBackground, 0, 0)
StopDrawing()
FlipBuffers()
Y = Y - 8
If Y<0
Y = ScreenHeight
EndIf
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
CloseScreen()
End
;-----------------------------------------------------------------
DataSection
Background: IncludeBinary "Background.png"
Beginner : DrawImage
The DrawImage() command requires an imageid rather than an image#.
So change the 3 DrawImage() commands and it should work.
E.g.
etc.
So change the 3 DrawImage() commands and it should work.
E.g.
Code: Select all
DrawImage(ImageID(ImgTile), 0, 0)
I may look like a mule, but I'm not a complete ass.
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Wow !
It has been said the community here is very good.
It's awesome ! Thank you !
It's awesome ! Thank you !