PureBasic Forum https://www.purebasic.fr/english/ |
|
My First Screen Saver https://www.purebasic.fr/english/viewtopic.php?f=27&t=74195 |
Page 1 of 4 |
Author: | J. Baker [ Thu Dec 12, 2019 7:30 am ] |
Post subject: | My First Screen Saver |
Here's my first screen saver in PureBasic. PoseMotion Christmas! ![]() V1.4.2 Download PoseMotion Christmas Now with Installer that installs and uninstalls the screen saver! ![]() Screen Saver Template Code: 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") ;*********************************************************************** |
Author: | BarryG [ Thu Dec 12, 2019 8:21 am ] |
Post subject: | Re: My First Screen Saver |
Nice, but the flakes fall too fast on my PC. Can they be slowed down in a future update? |
Author: | J. Baker [ Thu Dec 12, 2019 1:35 pm ] |
Post subject: | Re: My First Screen Saver |
Yes, I can do that. Sorry about that. |
Author: | dige [ Thu Dec 12, 2019 2:05 pm ] |
Post subject: | Re: My First Screen Saver |
Nice! It would be nice, if you could set your own picture as background. ![]() |
Author: | J. Baker [ Thu Dec 12, 2019 3:12 pm ] |
Post subject: | Re: My First Screen Saver |
Thanks! I will see what I can add. Adding a proper settings window now. Maybe some more graphics. I just added the source code template to the first post. It should be easy for anyone to edit/make their own screen savers. ![]() |
Author: | J. Baker [ Thu Dec 12, 2019 3:22 pm ] |
Post subject: | Re: My First Screen Saver |
BarryG wrote: Nice, but the flakes fall too fast on my PC. Can they be slowed down in a future update? I just fixed it. I hope. Let me know if it runs fine now. ![]() |
Author: | J. Baker [ Thu Dec 12, 2019 10:52 pm ] |
Post subject: | Re: My First Screen Saver |
Just added my Christmas 2019 screen saver to the original post above. This one has more graphics, animation, and a proper settings/about window. Still may add more to it. Enjoy and Merry Christmas! ![]() |
Author: | BarryG [ Fri Dec 13, 2019 8:18 am ] |
Post subject: | Re: My First Screen Saver |
J. Baker wrote: I just fixed it. I hope. Let me know if it runs fine now. ![]() Nice; they're not as fast now, and I love the addition of the window and the Christmas tree! Thanks. |
Author: | J. Baker [ Fri Dec 13, 2019 1:33 pm ] |
Post subject: | Re: My First Screen Saver |
BarryG wrote: Nice; they're not as fast now, and I love the addition of the window and the Christmas tree! Thanks. Glad to hear. I'm going to add a calendar next and I think that will finish it up. ![]() |
Author: | BarryG [ Fri Dec 13, 2019 1:45 pm ] |
Post subject: | Re: My First Screen Saver |
J. Baker wrote: I'm going to add a calendar next Please tell me it'll be an actual calendar with the current month, and not just a display one? Because a real one would be the icing on the cake! |
Author: | J. Baker [ Fri Dec 13, 2019 4:16 pm ] |
Post subject: | Re: My First Screen Saver |
BarryG wrote: Please tell me it'll be an actual calendar with the current month, and not just a display one? Because a real one would be the icing on the cake! It's real and the update is available to download now. ![]() |
Author: | J. Baker [ Fri Dec 13, 2019 5:04 pm ] |
Post subject: | Re: My First Screen Saver |
I forgot about the calendar updating at midnight. I just added it. New download available and I believe I'm done now. ![]() |
Author: | chi [ Fri Dec 13, 2019 5:50 pm ] |
Post subject: | Re: My First Screen Saver |
Nice one, thanks! A small note... When I right-click the .scr and click on "Configure", nothing is shown. |
Author: | J. Baker [ Fri Dec 13, 2019 5:57 pm ] |
Post subject: | Re: My First Screen Saver |
chi wrote: Nice one, thanks! A small note... When I right-click the .scr and click on "Configure", nothing is shown. I'll look into that but there's nothing to configure in this screen saver. I guess I could use some sort of message requester for that at the moment. Stating there's nothing to configure. Or link it to the Settings/About window. |
Author: | chi [ Fri Dec 13, 2019 7:21 pm ] |
Post subject: | Re: My First Screen Saver |
Oh, I always thought that "Configure" and "Settings..." opens the same window?! It's been a while since I last used a screensaver ![]() |
Page 1 of 4 | All times are UTC + 1 hour |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |