I have searched the forum and can't find anything to solve my issue.
I have the following program reading an INI file for window settings and setting the window size. Then it sets the window flags according to the window size. That worked great. But, now I can't get the image to resizing to work. My full screen setting is 1920x1080, but I have the INI file set to the windowed setting size 1280x720 to try and get the image to resize to that size. The size of the image is 1920x1080
It gives the following error:
The specified #Image is not initialized
Code: Select all
; main
UsePNGImageDecoder()
Enumeration Windows
#Window_Main
EndEnumeration
Enumeration Gadgets
#Gadget_Splash
EndEnumeration
Enumeration Images
#Img_Splash
EndEnumeration
Global.i WindowWidth, WindowHeight, Flags
; read ini file to set window settings
OpenPreferences("EFS_Preferences.ini")
PreferenceGroup("Window")
WindowWidth = ReadPreferenceLong("Window_Width", 0)
WindowHeight = ReadPreferenceLong("Window_Height", 0)
ClosePreferences()
; check window size for ini file and set correct window flags
If WindowWidth = 1920
Flags = #PB_Window_BorderLess
Else
Flags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered
EndIf
OpenWindow(#Window_Main, 0, 0, WindowWidth, WindowHeight, "European Football Simulator", Flags)
Img = LoadImage(#Img_Splash, "Images\SplashScreen.png")
If WindowWidth = 1280
Img_Resized = ResizeImage(Img, WindowWidth, WindowHeight)
EndIf
ImageGadget(#Gadget_Splash, 0, 0, WindowWidth, WindowHeight, Img_Resized)
Define QuitMain=0
Repeat
EventID =WaitWindowEvent()
MenuID =EventMenu()
GadgetID =EventGadget()
WindowID =EventWindow()
Select EventID
Case #PB_Event_CloseWindow
Select WindowID
Case #Window_Main
QuitMain = 1
EndSelect
EndSelect
Until QuitMain = 1
Code: Select all
[Global]
ApplicationName = European Football Simulator
Version = 1.0a
[Window]
Window_Width = 1280
Window_Height = 720


