FreeBASIC Screensaver Kit

User projects written in or related to FreeBASIC.
jofers
Posts: 1525
Joined: May 27, 2005 17:18
Contact:

FreeBASIC Screensaver Kit

Postby jofers » Sep 11, 2005 6:31

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: 191
Joined: May 27, 2005 5:22
Location: Earth
Contact:

Postby Plasma » Sep 11, 2005 6:55

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

Postby rdc » Sep 11, 2005 21:54

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

Postby jupiter3888 » Sep 12, 2005 11:23

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

Postby Antoni » Sep 12, 2005 17:10

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
Contact:

Postby jofers » Sep 12, 2005 20:42

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))
Pritchard
Posts: 5433
Joined: Sep 12, 2005 20:06
Location: Ohio, USA

Postby Pritchard » Sep 12, 2005 21:05

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

Postby Imortis » Sep 13, 2005 14:38

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:

Postby dumbledore » Sep 13, 2005 20:29

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
Posts: 1563
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Postby Imortis » Sep 14, 2005 16:01

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:

Postby relsoft » Sep 15, 2005 5:10

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

Postby mambazo » Sep 15, 2005 18:03

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:

Postby relsoft » Sep 19, 2005 6:25

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

Postby jofers » Sep 19, 2005 12:29

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:

Postby relsoft » Sep 21, 2005 11:04

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

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 2 guests