Page 1 of 3

Desktop FX

Posted: Fri Mar 16, 2007 9:01 pm
by Psychophanta
Code updated for 5.20+

Code: Select all

;Desktop FX by Psychophanta (Albert) 2007-03
Define .f
bitplanes.b=32
If ExamineDesktops():Global SCREENWIDTH=DesktopWidth(0),SCREENHEIGHT=DesktopHeight(0)
Else:Global SCREENWIDTH=GetSystemMetrics_(#SM_CXSCREEN),SCREENHEIGHT=GetSystemMetrics_(#SM_CYSCREEN)
EndIf
If InitSprite()=0 Or InitKeyboard()=0
  MessageRequester("Error","Can't access DirectX",0):End
EndIf
;SnapShot:
desktop.l = CreateImage(0,SCREENWIDTH,SCREENHEIGHT)
hdc.l = StartDrawing(ImageOutput(0))
SelectObject_(hdc,desktop)
BitBlt_(hdc,0,0,SCREENWIDTH,SCREENHEIGHT,GetDC_(GetDesktopWindow_()),0,0,#SRCCOPY)
StopDrawing()
DeleteDC_(hdc)
While OpenScreen(SCREENWIDTH,SCREENHEIGHT,bitplanes.b,"FullScreen")=0
  If bitplanes.b>16:bitplanes.b-8
  ElseIf SCREENHEIGHT>600:SCREENWIDTH=800:SCREENHEIGHT=600
  ElseIf SCREENHEIGHT>480:SCREENWIDTH=640:SCREENHEIGHT=480
  ElseIf SCREENHEIGHT>400:SCREENWIDTH=640:SCREENHEIGHT=400
  ElseIf SCREENHEIGHT>240:SCREENWIDTH=320:SCREENHEIGHT=240
  ElseIf SCREENHEIGHT>200:SCREENWIDTH=320:SCREENHEIGHT=200
  Else:MessageRequester("Listen:","Can't open Screen!",0):End
  EndIf
Wend
w=SCREENWIDTH:h=SCREENHEIGHT:z=1000/Sqr(3):perspw=w:PerspectiveAngle.d=#PI/16
CreateSprite(0,w,h)
StartDrawing(SpriteOutput(0))
DrawImage(ImageID(0),0,0)
StopDrawing()
DisplaySprite(0,0,0):FlipBuffers():DisplaySprite(0,0,0)
;
DataSection
Data.f 0.005,0.005,0.0045
EndDataSection
x3=w-1:x4=0:y3=h:y4=h:z3=z:z4=z
For t.b=1 To 3
  omega=-omega:Read alfa
  Repeat
    ExamineKeyboard():ClearScreen(0)
    Incrz=h*Sin(Angle)
    x1=Incrz*Tan(PerspectiveAngle):x2=x3-x1
    y1=h-h*Cos(Angle):y2=y1
    z1=z+Incrz/4.75:z2=z1
    TransformSprite(0,x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4)
    DisplayTransparentSprite(0,0,0,255)
    omega+alfa
    If omega<0:Angle-Pow(omega,2):Else:Angle+Pow(omega,2):EndIf
    If Angle<0 Or Angle>4/5*#PI:Break:EndIf
    FlipBuffers():Delay(16)
  Until KeyboardPushed(#PB_Key_Escape)
Next
DisplaySprite(0,0,0):FlipBuffers():Delay(16):DisplaySprite(0,0,0)
:)
Useful for when starting and finishing a screen saver for example :P

EDITED: now without use SuperSprite3D functions, but only Pure native.
EDITED2: Again and final :)

Posted: Fri Mar 16, 2007 9:05 pm
by netmaestro
Looks great! I like it very much!

Posted: Fri Mar 16, 2007 9:11 pm
by ts-soft
nice example, very good

Posted: Fri Mar 16, 2007 11:44 pm
by rsts
Very impressive.

Thanks.

Posted: Sat Mar 17, 2007 12:45 am
by srod
8)

Nice one.

Posted: Sat Mar 17, 2007 1:34 am
by Hroudtwolf
Image Very nice !

Posted: Sat Mar 17, 2007 2:29 am
by yrreti
WoW! Very nice.
I might add scary at first too! :lol: :lol:

Posted: Sat Mar 17, 2007 2:46 am
by JCV
cool! 8)
Nice example :wink:

Posted: Sat Mar 17, 2007 10:39 am
by Derek
Wow, very neat.

Posted: Sat Mar 17, 2007 11:38 am
by SCRJ
Very nice example! :D

*That's my new screen saver :mrgreen: *

Posted: Sat Mar 17, 2007 12:50 pm
by Num3
ARghhhh doesn't work...

I always get "Following variable does not have a structure:'V'"
In the DisplaySuperSprite3D(Scr) macro

Posted: Sat Mar 17, 2007 12:55 pm
by thefool
This is cool :D

Posted: Sat Mar 17, 2007 1:13 pm
by PB
> ARghhhh doesn't work

Works for everyone else who posted. :)
Re-install v4.02 clean and try it again.

Posted: Sat Mar 17, 2007 1:26 pm
by SFSxOI
very cool...., works great. Thank you. :)

Posted: Sat Mar 17, 2007 5:36 pm
by Psychophanta
Thanks :D
@Num3, that's wierd, you should do what PB wrote. :)