Another screensaver

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Another screensaver

Post by Psychophanta »

Today i've learned how to do an screensaver for windows,
thanks to Kale, netmaestro, Danilo, and others :wink:
Here
BTW, it works with smooth movements if at 60Hz refresh rate and modern PCs.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Link doesn't work :cry:
BERESHEIT
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

netmaestro wrote:Link doesn't work :cry:
now !
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Looks good! Excellent start, I'd recommend antialias for the ball edges and you don't have the scale right for the preview screen. For that to be correct you need to make your windowed screen the same size as your big main screen, just set autostretch to 1 and when you make it a child of the preview windowhandle it'll be scaled perfect.
BERESHEIT
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

netmaestro wrote:Looks good! Excellent start, I'd recommend antialias for the ball edges and you don't have the scale right for the preview screen. For that to be correct you need to make your windowed screen the same size as your big main screen, just set autostretch to 1 and when you make it a child of the preview windowhandle it'll be scaled perfect.
Thank you, tomorrow i will do your recommendations, because i don't like the big size in the windowed screen.
About antialias i know how to do it too ;)
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Tiny demo: (resize/maximize the window and see result)

Code: Select all

InitSprite() 
w=GetSystemMetrics_(#SM_CXSCREEN)             ; w = FullScreen width
h=GetSystemMetrics_(#SM_CYSCREEN)             ; h = FullScreen height
OpenWindow(0,0,0,152,112,"",$CF0001)          ; Host Window is opened preview-window size
OpenWindowedScreen(WindowID(0),0,0,w,h,1,0,0) ; WindowedScreen size = FullScreen size ** important **
CreateSprite(0,128,128)                       ; It will scale itself to fit host window
StartDrawing(SpriteOutput(0))                 ; Your display routine for preview is identical to 
  Circle(64,64,64,#Red)                       ; fullscreen version, all scaling is managed by DX
StopDrawing() 

fwd=1:x=0
Repeat 
  ClearScreen(0) 
  If fwd:x+5:If x>=w-128:fwd=0:EndIf:Else:x-5:If x<1:fwd=1:EndIf:EndIf
  DisplaySprite(0,x,h/2-64) 
  FlipBuffers() 
  ev=WaitWindowEvent(1) 
Until ev = #WM_CLOSE 
Last edited by netmaestro on Sun Mar 04, 2007 6:06 am, edited 3 times in total.
BERESHEIT
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

Very nice. Thanks.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

It is done.
I've been testing something with antialias, but finally i will not do it because i decided it is uses too much CPU for an almost useless thing. :P
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

How much CPU would it use? Currently it's very near 0 here, I can't believe using alphablended images would raise it that much. And if a screensaver uses a bit of CPU, say 10% or so, that shouldn't be a problem as the machine isn't being used at the time and if a job is running it's got 90% of the CPU available to it. To me, the advantage of having lovely alphablended images is worth it.
BERESHEIT
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

Looks good. I made an even more useless screen saver some time ago. Just displayed some static text hehehe. But, I got your screen saver installed on my laptop now. Runs smoothly, but it would be nice if you made it with anti alizing ;)
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

You doesn't need real antialiasing or aplhablending at all, just make the edges more "soft" and do this on a black bakground and I think it would look quite nice. Great physics btw! ;)
I like logic, hence I dislike humans but love computers.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Joakim Christiansen wrote:You doesn't need real antialiasing or aplhablending at all, just make the edges more "soft" and do this on a black bakground and I think it would look quite nice. Great physics btw! ;)
Exactly :wink:
It is what i was thinking about.
I don't use Sprite3D there, so then this one is what i will do just now.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
r_hyde
Enthusiast
Enthusiast
Posts: 155
Joined: Wed Jul 05, 2006 12:40 am

Post by r_hyde »

Thanks for the screensaver. I keep watching it just to see what the balls will do next!
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

Doesn't work...
Just get a black screen...
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Num3 wrote:Doesn't work...
Just get a black screen...
Ooops,
get now :)
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Post Reply