Explain this one LOL. All I did was load a previously made icef file into the latest version of IceDesign, add a
that is showing out of place to see if it would work and it did. why it works now I have no clue. I didn't have to do anything you suggested
Code: Select all
;- Top
; -----------------------------------------------------------------------------
; Name:
; Description:
; Author:
; Date: 2024-09-18
; Version:
; PB-Version:
; OS:
; Credit:
; Forum:
; Created by: IceDesign
; -----------------------------------------------------------------------------
CompilerIf #PB_Compiler_IsMainFile
EnableExplicit
CompilerEndIf
;- Enumerations
Enumeration Window
#Window_EFS_Settings
EndEnumeration
Enumeration Gadgets
#Btn_1
#Btn_Autosave
#Btn_Full_Screen
#Btn_Music
#Btn_Sound_Effects
#Btn_Text_Commentary
#Btn_Voice_Commentary
#Btn_Weather_Conditions
#Btn_Window_1200_x_800
#Frame_AutoSaveSettings
#Frame_CommSettings
#Frame_SoundSettings
#Frame_WeathCondSettings
#Frame_WindowSettings
#Img_EFF_Settings
#Txt_AutoSave
#Txt_CommSettings
#Txt_EFS_Settings_Title
#Txt_SoundSettings
#Txt_WeatherConditions
#Txt_WindowSettings
EndEnumeration
Enumeration Images
#Imag_EFS_Preferences
EndEnumeration
Enumeration Fonts
#Font_Mx437_HP_100LX_6x8_8
#Font_Mx437_HP_100LX_6x8_10
#Font_Mx437_HP_100LX_6x8_18
EndEnumeration
CompilerIf Not Defined(GadgetImages, #PB_Structure)
Structure GadgetImages
Image.i
PressedImage.i
Width.i
Height.i
EndStructure
CompilerEndIf
;- Load Images
UsePNGImageDecoder()
CatchImage(#Imag_EFS_Preferences, ?Imag_EFS_Preferences)
;- Load Fonts
LoadFont(#Font_Mx437_HP_100LX_6x8_8, "@Mx437 HP 100LX 6x8", 8)
LoadFont(#Font_Mx437_HP_100LX_6x8_10, "@Mx437 HP 100LX 6x8", 10)
LoadFont(#Font_Mx437_HP_100LX_6x8_18, "@Mx437 HP 100LX 6x8", 18)
Global Quit
;- Declare
Declare Event_Img_EFF_Settings()
Declare Event_Btn_1()
Declare Event_Btn_Voice_Commentary()
Declare Event_Btn_Window_1200_x_800()
Declare Event_Btn_Text_Commentary()
Declare Event_Btn_Full_Screen()
Declare Event_Btn_Autosave()
Declare Event_Btn_Weather_Conditions()
Declare Event_Btn_Sound_Effects()
Declare Event_Btn_Music()
CompilerIf Not Defined(GadgetImages, #PB_Structure)
Declare ResizeGadgetImage(Gadget, OriginalImage, OriginalPressedImage = #PB_Ignore)
CompilerEndIf
Declare Resize_Window_EFS_Settings()
Declare Event_Close_Window_EFS_Settings()
Declare Open_Window_EFS_Settings(X = 0, Y = 0, Width = 1200, Height = 800)
XIncludeFile "ObjectTheme.pbi"
UseModule ObjectTheme
XIncludeFile "JellyButtons.pbi"
Procedure Event_Img_EFF_Settings()
Select EventType()
Case #PB_EventType_LeftClick
EndSelect
EndProcedure
Procedure Event_Btn_1()
Select EventType()
Case #PB_EventType_LeftClick
MessageRequester("Information", "Button Name : #Btn_1" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
EndSelect
EndProcedure
Procedure Event_Btn_Voice_Commentary()
Select EventType()
Case #PB_EventType_LeftClick
MessageRequester("Information", "Button Name : #Btn_Voice_Commentary" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
EndSelect
EndProcedure
Procedure Event_Btn_Window_1200_x_800()
Select EventType()
Case #PB_EventType_LeftClick
MessageRequester("Information", "Button Name : #Btn_Window_1200_x_800" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
EndSelect
EndProcedure
Procedure Event_Btn_Text_Commentary()
Select EventType()
Case #PB_EventType_LeftClick
MessageRequester("Information", "Button Name : #Btn_Text_Commentary" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
EndSelect
EndProcedure
Procedure Event_Btn_Full_Screen()
Select EventType()
Case #PB_EventType_LeftClick
MessageRequester("Information", "Button Name : #Btn_Full_Screen" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
EndSelect
EndProcedure
Procedure Event_Btn_Autosave()
Select EventType()
Case #PB_EventType_LeftClick
MessageRequester("Information", "Button Name : #Btn_Autosave" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
EndSelect
EndProcedure
Procedure Event_Btn_Weather_Conditions()
Select EventType()
Case #PB_EventType_LeftClick
MessageRequester("Information", "Button Name : #Btn_Weather_Conditions" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
EndSelect
EndProcedure
Procedure Event_Btn_Sound_Effects()
Select EventType()
Case #PB_EventType_LeftClick
MessageRequester("Information", "Button Name : #Btn_Sound_Effects" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
EndSelect
EndProcedure
Procedure Event_Btn_Music()
Select EventType()
Case #PB_EventType_LeftClick
MessageRequester("Information", "Button Name : #Btn_Music" +#CRLF$+#CRLF$+ "Text : " + GetGadgetText(EventGadget()))
EndSelect
EndProcedure
CompilerIf Not Defined(ResizeGadgetImage, #PB_Procedure)
Procedure ResizeGadgetImage(Gadget, OriginalImage, OriginalPressedImage = #PB_Ignore)
Protected Image, Width, Height
Static NewMap GadgetImage.GadgetImages()
If IsGadget(Gadget) And IsImage(OriginalImage)
Width = DesktopScaledX(GadgetWidth(Gadget)) : Height = DesktopScaledY(GadgetHeight(Gadget))
If Width > 0 And Height > 0
If GadgetImage(Str(Gadget))\Width <> Width Or GadgetImage(Str(Gadget))\Height <> Height
GadgetImage()\Width = Width : GadgetImage()\Height = Height
Image = CopyImage(OriginalImage, #PB_Any)
If Image
ResizeImage(Image, Width, Height)
Select GadgetType(Gadget)
Case #PB_GadgetType_ButtonImage
SetGadgetAttribute(Gadget, #PB_Button_Image, ImageID(Image))
Case #PB_GadgetType_Image
SetGadgetState(Gadget, ImageID(Image))
EndSelect
If GadgetImage()\Image And IsImage(GadgetImage()\Image)
FreeImage(GadgetImage()\Image)
EndIf
GadgetImage()\Image = Image
EndIf
If GadgetType(Gadget) = #PB_GadgetType_ButtonImage And IsImage(OriginalPressedImage)
Image = CopyImage(OriginalPressedImage, #PB_Any)
If Image
ResizeImage(Image, Width, Height)
SetGadgetAttribute(Gadget, #PB_Button_PressedImage, ImageID(Image))
If GadgetImage()\PressedImage And IsImage(GadgetImage()\PressedImage)
FreeImage(GadgetImage()\PressedImage)
EndIf
GadgetImage()\PressedImage = Image
EndIf
EndIf
EndIf ; If GadgetImage(Str(Gadget))\Width <> Width Or GadgetImage(Str(Gadget))\Height <> Height
EndIf ; If Width > 0 And Height > 0
EndIf ; If IsGadget(Gadget) And IsImage(OriginalImage)
EndProcedure
CompilerEndIf
Procedure Resize_Window_EFS_Settings()
Protected Window_EFS_Settings_WidthIni = 1200, Window_EFS_Settings_HeightIni = 800
Protected ScaleX.f, ScaleY.f
ScaleX = WindowWidth(#Window_EFS_Settings) / Window_EFS_Settings_WidthIni : ScaleY = WindowHeight(#Window_EFS_Settings) / Window_EFS_Settings_HeightIni
ResizeGadget(#Img_EFF_Settings, ScaleX * 0, ScaleY * 0, ScaleX * 1200, ScaleY * 800)
ResizeGadgetImage(#Img_EFF_Settings, #Imag_EFS_Preferences)
ResizeGadget(#Txt_EFS_Settings_Title, ScaleX * 478, ScaleY * 20, ScaleX * 244, ScaleY * 28)
ResizeGadget(#Btn_1, ScaleX * 386, ScaleY * 154, ScaleX * 100, ScaleY * 35)
ResizeGadget(#Frame_WindowSettings, ScaleX * 203, ScaleY * 245, ScaleX * 266, ScaleY * 106)
ResizeGadget(#Frame_CommSettings, ScaleX * 728, ScaleY * 245, ScaleX * 267, ScaleY * 106)
ResizeGadget(#Txt_CommSettings, ScaleX * 761, ScaleY * 257, ScaleX * 205, ScaleY * 17)
ResizeGadget(#Txt_WindowSettings, ScaleX * 231, ScaleY * 258, ScaleX * 210, ScaleY * 17)
ResizeGadget(#Btn_Voice_Commentary, ScaleX * 736, ScaleY * 282, ScaleX * 251, ScaleY * 25)
ResizeGadget(#Btn_Window_1200_x_800, ScaleX * 211, ScaleY * 283, ScaleX * 250, ScaleY * 25)
ResizeGadget(#Btn_Text_Commentary, ScaleX * 736, ScaleY * 317, ScaleX * 251, ScaleY * 25)
ResizeGadget(#Btn_Full_Screen, ScaleX * 211, ScaleY * 318, ScaleX * 250, ScaleY * 25)
ResizeGadget(#Frame_AutoSaveSettings, ScaleX * 467, ScaleY * 365, ScaleX * 267, ScaleY * 73)
ResizeGadget(#Txt_AutoSave, ScaleX * 510, ScaleY * 378, ScaleX * 181, ScaleY * 17)
ResizeGadget(#Btn_Autosave, ScaleX * 475, ScaleY * 403, ScaleX * 251, ScaleY * 25)
ResizeGadget(#Frame_SoundSettings, ScaleX * 203, ScaleY * 451, ScaleX * 266, ScaleY * 106)
ResizeGadget(#Frame_WeathCondSettings, ScaleX * 728, ScaleY * 451, ScaleX * 267, ScaleY * 73)
ResizeGadget(#Txt_WeatherConditions, ScaleX * 761, ScaleY * 463, ScaleX * 205, ScaleY * 17)
ResizeGadget(#Txt_SoundSettings, ScaleX * 257, ScaleY * 464, ScaleX * 160, ScaleY * 17)
ResizeGadget(#Btn_Weather_Conditions, ScaleX * 736, ScaleY * 488, ScaleX * 251, ScaleY * 25)
ResizeGadget(#Btn_Sound_Effects, ScaleX * 211, ScaleY * 489, ScaleX * 250, ScaleY * 25)
ResizeGadget(#Btn_Music, ScaleX * 211, ScaleY * 524, ScaleX * 250, ScaleY * 25)
EndProcedure
Procedure Event_Close_Window_EFS_Settings()
Quit = #True
EndProcedure
Procedure Open_Window_EFS_Settings(X = 0, Y = 0, Width = 1200, Height = 800)
If OpenWindow(#Window_EFS_Settings, X, Y, Width, Height, "European Football Simulator", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
ImageGadget(#Img_EFF_Settings, 0, 0, 1200, 800, ImageID(#Imag_EFS_Preferences))
DisableGadget(#Img_EFF_Settings, #True)
TextGadget(#Txt_EFS_Settings_Title, 478, 20, 244, 28, "Game Settings", #PB_Text_Center | #SS_CenterImage)
SetGadgetColor(#Txt_EFS_Settings_Title, #PB_Gadget_BackColor, RGB(0, 0, 0))
SetGadgetColor(#Txt_EFS_Settings_Title, #PB_Gadget_FrontColor, RGB(255, 255, 0))
SetGadgetFont(#Txt_EFS_Settings_Title, FontID(#Font_Mx437_HP_100LX_6x8_18))
ButtonGadget(#Btn_1, 386, 154, 100, 35, "Button_1")
FrameGadget(#Frame_WindowSettings, 203, 245, 266, 106, "", #PB_Frame_Double)
SetGadgetFont(#Frame_WindowSettings, FontID(#Font_Mx437_HP_100LX_6x8_8))
FrameGadget(#Frame_CommSettings, 728, 245, 267, 106, "", #PB_Frame_Double)
SetGadgetFont(#Frame_CommSettings, FontID(#Font_Mx437_HP_100LX_6x8_8))
TextGadget(#Txt_CommSettings, 761, 257, 205, 17, "Commentary Settings:", #SS_CenterImage)
SetGadgetColor(#Txt_CommSettings, #PB_Gadget_BackColor, RGB(0, 0, 0))
SetGadgetColor(#Txt_CommSettings, #PB_Gadget_FrontColor, RGB(255, 255, 0))
SetGadgetFont(#Txt_CommSettings, FontID(#Font_Mx437_HP_100LX_6x8_10))
TextGadget(#Txt_WindowSettings, 231, 258, 210, 17, "Window Mode Settings:", #SS_CenterImage)
SetGadgetColor(#Txt_WindowSettings, #PB_Gadget_BackColor, RGB(0, 0, 0))
SetGadgetColor(#Txt_WindowSettings, #PB_Gadget_FrontColor, RGB(255, 255, 0))
SetGadgetFont(#Txt_WindowSettings, FontID(#Font_Mx437_HP_100LX_6x8_10))
JellyButton(#Btn_Voice_Commentary, 736, 282, 251, 25, "Voice Commentary On", RGB(0, 128, 0), RGB(255, 255, 0), #PB_Button_Toggle)
SetGadgetFont(#Btn_Voice_Commentary, FontID(#Font_Mx437_HP_100LX_6x8_10))
JellyButton(#Btn_Window_1200_x_800, 211, 283, 250, 25, "Window 1200 x 800 Off", RGB(255, 0, 0), RGB(255, 255, 0), #PB_Button_Toggle)
SetGadgetFont(#Btn_Window_1200_x_800, FontID(#Font_Mx437_HP_100LX_6x8_10))
JellyButton(#Btn_Text_Commentary, 736, 317, 251, 25, "Text Commentary Off", RGB(255, 0, 0), RGB(255, 255, 0), #PB_Button_Toggle)
SetGadgetFont(#Btn_Text_Commentary, FontID(#Font_Mx437_HP_100LX_6x8_10))
JellyButton(#Btn_Full_Screen, 211, 318, 250, 25, "Full Screen On", RGB(0, 128, 0), RGB(255, 255, 0), #PB_Button_Toggle)
SetGadgetFont(#Btn_Full_Screen, FontID(#Font_Mx437_HP_100LX_6x8_10))
FrameGadget(#Frame_AutoSaveSettings, 467, 365, 267, 73, "", #PB_Frame_Double)
SetGadgetFont(#Frame_AutoSaveSettings, FontID(#Font_Mx437_HP_100LX_6x8_8))
TextGadget(#Txt_AutoSave, 510, 378, 181, 17, "Autosave Settings:", #SS_CenterImage)
SetGadgetColor(#Txt_AutoSave, #PB_Gadget_BackColor, RGB(0, 0, 0))
SetGadgetColor(#Txt_AutoSave, #PB_Gadget_FrontColor, RGB(255, 255, 0))
SetGadgetFont(#Txt_AutoSave, FontID(#Font_Mx437_HP_100LX_6x8_10))
JellyButton(#Btn_Autosave, 475, 403, 251, 25, "Autosave On", RGB(0, 128, 0), RGB(255, 255, 0), #PB_Button_Toggle)
SetGadgetFont(#Btn_Autosave, FontID(#Font_Mx437_HP_100LX_6x8_10))
FrameGadget(#Frame_SoundSettings, 203, 451, 266, 106, "", #PB_Frame_Double)
SetGadgetFont(#Frame_SoundSettings, FontID(#Font_Mx437_HP_100LX_6x8_8))
FrameGadget(#Frame_WeathCondSettings, 728, 451, 267, 73, "", #PB_Frame_Double)
SetGadgetFont(#Frame_WeathCondSettings, FontID(#Font_Mx437_HP_100LX_6x8_8))
TextGadget(#Txt_WeatherConditions, 761, 463, 205, 17, "Weather Conditions:", #SS_CenterImage)
SetGadgetColor(#Txt_WeatherConditions, #PB_Gadget_BackColor, RGB(0, 0, 0))
SetGadgetColor(#Txt_WeatherConditions, #PB_Gadget_FrontColor, RGB(255, 255, 0))
SetGadgetFont(#Txt_WeatherConditions, FontID(#Font_Mx437_HP_100LX_6x8_10))
TextGadget(#Txt_SoundSettings, 257, 464, 160, 17, "Sound Settings:", #SS_CenterImage)
SetGadgetColor(#Txt_SoundSettings, #PB_Gadget_BackColor, RGB(0, 0, 0))
SetGadgetColor(#Txt_SoundSettings, #PB_Gadget_FrontColor, RGB(255, 255, 0))
SetGadgetFont(#Txt_SoundSettings, FontID(#Font_Mx437_HP_100LX_6x8_10))
JellyButton(#Btn_Weather_Conditions, 736, 488, 251, 25, "Weather Conditions On", RGB(0, 128, 0), RGB(255, 255, 0), #PB_Button_Toggle)
SetGadgetFont(#Btn_Weather_Conditions, FontID(#Font_Mx437_HP_100LX_6x8_10))
JellyButton(#Btn_Sound_Effects, 211, 489, 250, 25, "Sound Effects On", RGB(0, 128, 0), RGB(255, 255, 0), #PB_Button_Toggle)
SetGadgetFont(#Btn_Sound_Effects, FontID(#Font_Mx437_HP_100LX_6x8_10))
JellyButton(#Btn_Music, 211, 524, 250, 25, "Music On", RGB(0, 128, 0), RGB(255, 255, 0), #PB_Button_Toggle)
SetGadgetFont(#Btn_Music, FontID(#Font_Mx437_HP_100LX_6x8_10))
BindGadgetEvent(#Img_EFF_Settings, @Event_Img_EFF_Settings())
BindGadgetEvent(#Btn_1, @Event_Btn_1())
BindGadgetEvent(#Btn_Voice_Commentary, @Event_Btn_Voice_Commentary())
BindGadgetEvent(#Btn_Window_1200_x_800, @Event_Btn_Window_1200_x_800())
BindGadgetEvent(#Btn_Text_Commentary, @Event_Btn_Text_Commentary())
BindGadgetEvent(#Btn_Full_Screen, @Event_Btn_Full_Screen())
BindGadgetEvent(#Btn_Autosave, @Event_Btn_Autosave())
BindGadgetEvent(#Btn_Weather_Conditions, @Event_Btn_Weather_Conditions())
BindGadgetEvent(#Btn_Sound_Effects, @Event_Btn_Sound_Effects())
BindGadgetEvent(#Btn_Music, @Event_Btn_Music())
BindEvent(#PB_Event_SizeWindow, @Resize_Window_EFS_Settings(), #Window_EFS_Settings)
PostEvent(#PB_Event_SizeWindow, #Window_EFS_Settings, 0)
BindEvent(#PB_Event_CloseWindow, @Event_Close_Window_EFS_Settings(), #Window_EFS_Settings)
ProcedureReturn #True
EndIf
EndProcedure
CompilerIf #PB_Compiler_IsMainFile
;- Main Program
SetObjectTheme(#ObjectTheme_DarkBlue)
If Open_Window_EFS_Settings()
;- Event Loop
Repeat
Select WaitWindowEvent()
EndSelect
Until Quit
EndIf
CompilerEndIf
;- DataSection
DataSection
Imag_EFS_Preferences: : IncludeBinary "C:\Users\manua\Documents\IceDesign Projects\EFS\Images\EFS_Preferences.png"
EndDataSection