[graphicFX] something round.

Share your advanced PureBasic knowledge/code with the community.
benny
Enthusiast
Enthusiast
Posts: 465
Joined: Fri Apr 25, 2003 7:44 pm
Location: end of www
Contact:

[graphicFX] something round.

Post by benny »

Code updated For 5.20+

Neither very advanced nor really a trick or tip. Just some usage of
rotating circles.

[EDIT]DrawingMode added.[/EDIT]

Code: Select all

; something round.
; a conversion of an old demoFX
; by benny|weltenkonstrukteur.de
; o8.o6.o5
; original author: unknown

winTitle.s  = "something round."
#LOOPTIME   = 1000/14  ; 40 Frames in 1000ms (1second)

hwnd.l = OpenWindow(0, 0,0, 320, 240, winTitle.s, #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If hwnd
  If InitSprite()
    If OpenWindowedScreen(hwnd, 0, 0, 320, 240, 0, 0, 0)
      
      Dim px.f(15)
      Dim py.f(15)
      
      Repeat   
        
        Select WindowEvent()
          Case #PB_Event_CloseWindow
            Quit = #True
        EndSelect
        
        FlipBuffers()
        If IsScreenActive() 
          ClearScreen(RGB(0,0,0))
          StartDrawing(ScreenOutput())   
          DrawingMode(2) ; Play around with this
          px(0) = 160+8*Cos(a.f)
          py(0) = 120+8*Sin(a.f)
          For i=1 To 14
            px(i-1) = px (i)
            py(i-1) = py (i)
            px(i) = 160+8*Cos (a.f * (1+i*0.1))
            py(i) = 120+8*Sin (a.f * (1+i*0.1))
            Circle(px(i-1), py(i-1), 100-i*8, RGB(0,0,0))
            Circle(px(i), py(i), 110-i*8, RGB(255,255,255))
          Next i
          a + 0.4
          StopDrawing()
        EndIf
        
        ; Run Program at a constant rate 
        While ( ElapsedMilliseconds()-LoopTimer )<#LOOPTIME : Delay(1) : Wend 
        LoopTimer = ElapsedMilliseconds()
      Until Quit = #True
      
    EndIf
  EndIf
EndIf
End

Last edited by benny on Fri Jun 10, 2005 8:26 pm, edited 3 times in total.
regards,
benny!
-
pe0ple ar3 str4nge!!!
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

That was pretty cool.
I haven't done any 2d or 3d stuff yet but I liked it :)
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
benny
Enthusiast
Enthusiast
Posts: 465
Joined: Fri Apr 25, 2003 7:44 pm
Location: end of www
Contact:

Post by benny »

GeoTrail wrote:That was pretty cool.
I haven't done any 2d or 3d stuff yet but I liked it :)
@GeoTrail:

Thanks ... I added the DrawingMode command to the above source.
You can use values from 0 ... 4 for different results.
regards,
benny!
-
pe0ple ar3 str4nge!!!
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

Try this

Code: Select all

DrawingMode(0|2|4)
I think that looks kinda cool hehehe
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
benny
Enthusiast
Enthusiast
Posts: 465
Joined: Fri Apr 25, 2003 7:44 pm
Location: end of www
Contact:

Post by benny »

that gives it a sketchy and artistic style. n1 :!:
regards,
benny!
-
pe0ple ar3 str4nge!!!
Post Reply