FreeBASIC Screensaver Kit

User contributed sources that have become inactive, deprecated, or generally unusable. But ... we don't really want to throw them away either.
jofers
Posts: 1525
Joined: May 27, 2005 17:18

FreeBASIC Screensaver Kit

Post by jofers »

OK, there seems to be a lot of interest in screensavers lately, so I made a "helper" kit so people who don't want to learn the WinAPI don't have to use "dirty screensavers" that just sniff out the command line and use GFXLib.

http://www.betterwebber.com/stuff/FB_ScreenSaverKit.zip

Just unzip, and include this at the top of your program:

Code: Select all

#include "FB_ScreenSaverKit.bas"
StartScreenSaver

Pset (x, y), colr
'...
Then you can just start using Pset, Line, etc. It sets up a NULL GFXLib driver, and copies that to a window 60 times a second. If the screensaver is in preview mode, it stretches it so it fits in that little box. If you include a dialog resource called "FB_SCRNSAVE_ABOUT" it will display that and close it when the "IDOK" button is pressed, or show a messagebox if a resource isn't included.

Packaged is the kit, and a conversion of Mambazo's "Doodle" demo. Notice how the preview box and settings button work, and how there's no code related to that stuff in the actual program, FB_ScreenSaverKit.bas takes care of it all.

If you want/need a real settings box, then I might make a function where if you include a different dialog name it makes a modal dialog and lets you hook the message loop, and it doesn't save much effort unless I made a mechanism to save registry keys, which I don't feel like doing because I like registry undiddled.
Plasma
Posts: 205
Joined: May 27, 2005 5:22
Location: Earth
Contact:

Post by Plasma »

Very cool.
rdc
Posts: 1741
Joined: May 27, 2005 17:22
Location: Texas, USA
Contact:

Post by rdc »

Wow, that is great. Thanks!
jupiter3888
Posts: 103
Joined: Jun 30, 2005 3:54
Location: adelaide, australia
Contact:

Post by jupiter3888 »

wow. hahaha im going to have sooo much fun with this, i just know it!
Antoni
Posts: 1393
Joined: May 27, 2005 15:40
Location: Barcelona, Spain

Post by Antoni »

And it's too the first NULL GFXLIB example I have seen.It seems lillo forgot to write its's own....

Jofers: A feature you forgot to tell us. Startscreensaver copies the present screen to the GFXLIB buffer, so you don't need to do that if the saver "plays" with the present screen. If the screensaver does a diferent thing, just start erasing te buffer...

Great!!

EDITED: The only drawback. Windows API POINT interferes with GFXLIB's POINT, so i can't do a screen melt....
jofers
Posts: 1525
Joined: May 27, 2005 17:18

Post by jofers »

Yes, but you can still use the function from the runtime library:

Code: Select all

#define Point2(x, y) fb_GfxPoint(0, CSng(x), CSng(y))
anonymous1337
Posts: 5494
Joined: Sep 12, 2005 20:06
Location: California

Post by anonymous1337 »

Thanks! Man this will help a lot! Maybe...I can post one of my screensavers later for you guys?
Imortis
Moderator
Posts: 1924
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Post by Imortis »

Could Someone host this on FileAnchor? I would love to have it, but at my college most zip downloads are blocked. For some reson, FileAnchor isn't...
dumbledore
Posts: 680
Joined: May 28, 2005 1:11
Contact:

Post by dumbledore »

why don't you do it yourself? you can "upload" to fileanchor from the net as well as your computer, then download the stuff it just got for you ;)
Imortis
Moderator
Posts: 1924
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Post by Imortis »

Thanks for the tip dumbledore! I didn't know you could do that! Fileanchor now rocks even more then I thought it did before.
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Post by relsoft »

Shockingly awesome!
mambazo
Posts: 652
Joined: Jul 17, 2005 13:02
Location: Ireland
Contact:

Post by mambazo »

wow is this the growth of my seed in Tips & Tricks?!?! *grin*

excellant stuff here thanks a million!
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Post by relsoft »

Hey Joe, does it work with SDL + OpenGL?
jofers
Posts: 1525
Joined: May 27, 2005 17:18

Post by jofers »

Not really since it uses GDI. Can SDL/OpenGL write to ScreenPtr?

Also, if you wanted to help me with that, be my guest.
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Post by relsoft »

I don't know about GL writing to a GDI context. But I was thinking of a GL kit or something.
Post Reply