My First Screen Saver
Posted: Thu Dec 12, 2019 7:30 am
Here's my first screen saver in PureBasic. PoseMotion Christmas!
V1.5.0
Download PoseMotion Christmas
Now with Installer that installs and uninstalls the screen saver!
Screen Saver Template
V1.5.0
Download PoseMotion Christmas
Now with Installer that installs and uninstalls the screen saver!
Screen Saver Template
Code: Select all
InitSprite()
InitMouse()
InitKeyboard()
ExamineDesktops()
Global DPI.d = DesktopResolutionX()
UsePNGImageDecoder()
;***************Screen Saver Variables & Procedures (PBI)***************
IncludeFile("Snow Procedure.pbi")
;***********************************************************************
Global ParameterID.s = "", hWnd, pSize.RECT
Procedure Callback(hWnd, Message, wParam, lParam)
Protected Retval
Select Message
Case #WM_CLOSE
End
EndSelect
Retval = DefWindowProc_(hWnd, Message, wParam, lParam)
ProcedureReturn Retval
EndProcedure
Procedure Preview()
hWnd = Val(ParameterID)
GetClientRect_(hWnd, @PSize.RECT)
If OpenWindow(0, 0, ((pSize\bottom / DPI) - (((pSize\right / DPI) / 16) * 9)) / 2, pSize\right / DPI, ((pSize\right / DPI) / 16) * 9, "", #WS_CHILD, hWnd)
OpenWindowedScreen(WindowID(0), 0, 0, DesktopWidth(0) +110, DesktopHeight(0) -55, 1, 0, 0)
SetWindowCallback(@Callback())
SetWindowState(0, #PB_Window_Maximize) ;temp fix PureBasic 5.72
SetWindowState(0, #PB_Window_Normal) ;temp fix PureBasic 5.72
EndIf
If IsSprite(1) = 0
;**********************Preview Catch File(s)(PBI)***********************
IncludeFile("Snow Catch Files.pbi")
;***********************************************************************
EndIf
AddWindowTimer(0, 1, 16)
Repeat
ClearScreen(RGB(50, 100, 200))
WaitWindowEvent()
;************************Preview Animation(PBI)*************************
IncludeFile("Snow Preview Animation.pbi")
;***********************************************************************
FlipBuffers()
ForEver
EndProcedure
Procedure Settings()
;*************************Settings Window(PBI)**************************
IncludeFile("Snow Settings Window.pbi")
;***********************************************************************
EndProcedure
Para.s = ProgramParameter()
Parameter.s = LCase(Left(ReplaceString(Para.s,"-","/"), 2))
Select Parameter
Case "/p"
ParameterID = ProgramParameter()
Preview()
Case "/c"
Settings()
Case "/s"
;**Screen-Saver Screen, Catch File(s), Repeat Loop, & Animation (PBI)***
IncludeFile("Snow Animation.pbi")
;***********************************************************************
EndSelect
;********************Screen Saver Data Section (PBI)********************
IncludeFile("Snow Data.pbi")
;***********************************************************************