Page 1 of 1

Image refusing to draw

Posted: Sat Mar 08, 2025 3:53 pm
by Carm3D
I have a draw image command that is not very.... commanderly. It refuses to draw. The box draw works fine.

Code: Select all

    Event = WaitWindowEvent()
    UsePNGImageDecoder()
    ;FlipBuffers()
    StartDrawing(WindowOutput(WindowNum))
    DrawingMode(#PB_2DDrawing_Default)
    Box(0, 0, GameX, GameY, RGB(0, 0, 0))
    

    DrawImage(BatterySequence(0), 0, 0)
    StopDrawing()
    If Event = #PB_Event_CloseWindow
        EndProgram()
    EndIf
I used IsImage and BatterySequence(0) is a valid non-zero number. I checked it's width and height and they check out perfect. I used SaveImage and the resulting image saves fine and looks beautiful. PureBasic just doesn't want to draw it. Any ideas?

Re: Image refusing to draw

Posted: Sat Mar 08, 2025 4:12 pm
by ChrisR
Probably

Code: Select all

DrawImage(ImageID(BatterySequence(0)), 0, 0)
DrawImage need an ImageID as described in the help

Re: Image refusing to draw

Posted: Sun Mar 09, 2025 11:52 am
by Carm3D
ChrisR wrote: Sat Mar 08, 2025 4:12 pm Probably
DrawImage need an ImageID as described in the help
Yep! That was it! Took me a long time until I figured that out. Thank you!

Re: Image refusing to draw

Posted: Mon Mar 10, 2025 12:33 pm
by jacdelad
Don't worry, absolutely everyone of us stumbled across this at least once.