In Demivec's example code as exactly as it was posted, it didn't work straight off. It kept telling me with EnableExplicit have to be declared: x.
[18:57:48] [COMPILER] Line 29: With 'EnableExplicit', variables have to be declared: x.
[18:59:00] [COMPILER] Line 29: With 'EnableExplicit', variables have to be declared: x.
[19:00:38] [COMPILER] Line 29: With 'EnableExplicit', variables have to be declared: x.
[19:01:30] [COMPILER] Line 29: With 'EnableExplicit', variables have to be declared: x.
[19:02:08] [COMPILER] Line 29: With 'EnableExplicit', variables have to be declared: x.
[19:02:32] [COMPILER] Line 29: With 'EnableExplicit', variables have to be declared: x.
[19:06:21] [COMPILER] Line 30: With 'EnableExplicit', variables have to be declared: x.
I'm not familar with certain commands in the code example, including "EnableExplicit". I still have a lot to learn. Sometimes I have to have a simplified explanation to comprehend something. I had to Rem out the EnableExplicit command and it worked. That is the only thing I had to do to get it to work
I will continue to study people's examples to learn and refer to the help files. The help files are even confusing sometimes, but sometimes I can find something online that explains things in simplified terms and I understand it better. I hope In a couple of years I'll be decently good in PureBasic. It has me addicted to it lol.
Code: Select all
; Splash Screen Include
;EnableExplicit
UsePNGImageDecoder()
;these enumerations are just to help make things more readable later
Enumeration gadgets
#g_Canvas
EndEnumeration
Enumeration windows
#w_Main
EndEnumeration
Enumeration timers
#t_splashscreen
EndEnumeration
Define CloseSplashScreen = #False
;Triggered by Event() = #PB_Event_Gadget, EventGadget() = #g_Canvas, EventType() = #PB_EventType_LeftClick
Procedure MouseClick()
Shared CloseSplashScreen
CloseSplashScreen = #True
EndProcedure
;Triggered by Event() = #PB_Event_Timer, EventTimer() = #t_splashscreen
Procedure SplashScreenTimeout()
Shared CloseSplashScreen
CloseSplashScreen = #True
EndProcedure
Procedure SplashScreen()
Define ImgFile, Event
Shared CloseSplashScreen
OpenWindow(#w_Main, 0, 0, 1024, 576, "Ultimate Football Manager", #PB_Window_ScreenCentered)
;OpenScreen(1024, 576, 32, "Ultimate Football Manager", 0, 60)
CanvasGadget(#g_Canvas, 0, 0, 1024, 576)
ImgFile = LoadImage(#PB_Any, "C:\Users\Brian\Documents\Pure Basic Projects\Ultimate Football Manager\Media\UFM1.png"); "test UFM1.png"
SetGadgetAttribute(#g_Canvas, #PB_Canvas_Image, ImageID(ImgFile))
AddWindowTimer(#w_Main, #t_splashscreen, 4000)
BindEvent(#PB_Event_Gadget, @MouseClick(), #w_Main, #g_Canvas, #PB_EventType_LeftClick)
BindEvent(#PB_Event_Timer, @SplashScreenTimeout(), #w_Main, #t_splashscreen)
Repeat
Event = WaitWindowEvent()
Until CloseSplashScreen = #True Or Event = #PB_Event_CloseWindow
FreeImage(ImgFile)
UnbindEvent(#PB_Event_Timer, @SplashScreenTimeout(), #w_Main, #t_splashscreen)
UnbindEvent(#PB_Event_Gadget, @MouseClick(), #w_Main, #g_Canvas, #PB_EventType_LeftClick)
CloseWindow(#w_Main)
EndProcedure
;-----------------------------------------------------------------
CompilerIf #PB_Compiler_IsMainFile
SplashScreen()
MessageRequester("Tada!", "All Done!")
CompilerEndIf