Page 1 of 1

Image not showing in window with ImageGadget

Posted: Thu Mar 27, 2025 12:52 am
by Distorted Pixel
Hi,

I can't believe I'm having this problem. It is simple to do, but what is wrong with this code.
As the code is below, it shows a blank window.

If I use ImageID(Img_SplashScreen) in the place of the variable at the end of the ImageGadget, it says "[ERROR] The specified #Image is not initialized"

Code: Select all

Global Win_SplashScreen = 1
Global Img_SplashScreen = 1
Global Gadget_SplashScreen = 1

Flags = #PB_Window_BorderLess
OpenWindow(Win_SplashScreen, 0, 0, 1920, 1080, "European Football Simulator", Flags)

LoadImage(Img_SplashScreen, "Images\SplashScreen.png")

ImageGadget(Gadget_SplashScreen, 0, 0, 1920, 1080, Img_SplashScreen)

Repeat
  Event = WaitWindowEvent()
  
  
Until Event = #PB_Event_CloseWindow

Re: Image not showing in window with ImageGadget

Posted: Thu Mar 27, 2025 12:55 am
by Paul
UsePNGImageDecoder() ??

Re: Image not showing in window with ImageGadget

Posted: Thu Mar 27, 2025 12:58 am
by Sergey
Hi,
1) UsePNGImageDecoder() at the beginning
2) ImageID(Img_SplashScreen)
And all will be ok ;-)

Re: Image not showing in window with ImageGadget

Posted: Thu Mar 27, 2025 1:02 am
by Distorted Pixel
Paul wrote: Thu Mar 27, 2025 12:55 am UsePNGImageDecoder() ??
LOL OOPS Yes I did forget that so I could use the ImageID(). Thank you

Re: Image not showing in window with ImageGadget

Posted: Thu Mar 27, 2025 7:49 am
by infratec
For that reason you should always check the return values.
LoadImage() returns 0 in your case.

Re: Image not showing in window with ImageGadget

Posted: Thu Mar 27, 2025 5:54 pm
by Distorted Pixel
infratec wrote: Thu Mar 27, 2025 7:49 am For that reason you should always check the return values.
LoadImage() returns 0 in your case.
Yes, good idea thank you