My First Screen Saver

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

My First Screen Saver

Post by J. Baker »

Here's my first screen saver in PureBasic. PoseMotion Christmas! :D

V1.5.0
Download PoseMotion Christmas

Now with Installer that installs and uninstalls the screen saver!

Image

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")

;***********************************************************************
Last edited by J. Baker on Fri Jun 18, 2021 10:28 pm, edited 13 times in total.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: My First Screen Saver

Post by BarryG »

Nice, but the flakes fall too fast on my PC. Can they be slowed down in a future update?
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: My First Screen Saver

Post by J. Baker »

Yes, I can do that. Sorry about that.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
dige
Addict
Addict
Posts: 1247
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: My First Screen Saver

Post by dige »

Nice! It would be nice, if you could set your own picture as background. :)
"Daddy, I'll run faster, then it is not so far..."
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: My First Screen Saver

Post by J. Baker »

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. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: My First Screen Saver

Post by J. Baker »

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. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: My First Screen Saver

Post by J. Baker »

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! ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: My First Screen Saver

Post by BarryG »

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.
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: My First Screen Saver

Post by J. Baker »

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. :D
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: My First Screen Saver

Post by BarryG »

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!
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: My First Screen Saver

Post by J. Baker »

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. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: My First Screen Saver

Post by J. Baker »

I forgot about the calendar updating at midnight. I just added it. New download available and I believe I'm done now. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: My First Screen Saver

Post by chi »

Nice one, thanks!

A small note... When I right-click the .scr and click on "Configure", nothing is shown.
Et cetera is my worst enemy
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: My First Screen Saver

Post by J. Baker »

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.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: My First Screen Saver

Post by chi »

Oh, I always thought that "Configure" and "Settings..." opens the same window?! It's been a while since I last used a screensaver ;)
Et cetera is my worst enemy
Post Reply