Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Have fun
Message
From
21/05/2003 23:36:48
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
21/05/2003 22:11:24
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00791118
Message ID:
00791440
Views:
26
Hi Dave

>Now you've done it Mike. My whole office is inventing new patterns....

Glad I could improve your productivity ;) There was a kid's game that involved geared wheels and a pen to produce such designs, but I can't remember the name of it.

>Try:
>
>   .width    600
>   .height   600
>   x         300
>   y         150
>
>Beautiful!
>

I like that one!


>And for the arts award make these changes...
>DEFINE WINDOW Superwnd FROM 10,10 TO 50, 50 NAME mywnd
>  .WIDTH=500
>  .HEIGHT=500
>   xdir = 300
>   ydir = 150
>
>   IF m.x > 400 OR m.x < 100
>
>   IF m.y > 400 OR m.y < 25
>
>
>Awesome

That's not as good as your first one ;)

BTW, I remember something from another galaxy far away (a NEC APC III). There was a really hypnotic program called Eye of God.

Anyways, I modified the code to make it easier to change the settings. I also precalculated the COS and SIN values and stored them in an array for more speed. I think the bottleneck is the drawing of the circles now.

Here's the new version with your first set of numbers plugged in by default.
SET ESCAPE ON
ON ESCAPE DO iquit

*Window Dimensions
LOCAL lnRow1, lnCol1, lnRow2, lnCol2
lnRow1 = 10
lnCol1 = 10
lnRow2 = 30
lnCol2 = 30

*mywnd dimensions
LOCAL lnWidth, lnHeight
lnWidth = 600
lnHeight = 600


*Distance between consecutive circles
LOCAL xDir, yDir
xdir = 1
ydir = 1

*Initial starting point.
LOCAL x,y
x=300
y=150

*Initial Starting Angle
LOCAL Angle
Angle = 0

*Bounce boundaries
LOCAL lnMinX, lnMaxX, lnMinY, lnMaxY
lnMinX = 100
lnMaxX = 200
lnMinY = 100
lnMaxY = 200

*Precalculate COS and SIN
LOCAL lnI
LOCAL ARRAY laCOS[360 + 270], laSIN[360 + 270]
FOR lnI = 1 TO 360 + 270
  laCOS[m.lnI] = COS(DTOR(m.lnI))
  laSIN[m.lnI] = SIN(DTOR(m.lnI))
ENDFOR lnI

DEFINE WINDOW Superwnd FROM m.lnRow1,m.lnCol1 TO m.lnRow2, m.lnCol2 NAME mywnd

WITH mywnd
  .WIDTH = m.lnWidth
  .HEIGHT = m.lnHeight
  .AUTOCENTER=.T.
  SHOW WINDOW Superwnd
  SET CURSOR OFF
  ACTIVATE WINDOW Superwnd
  ACTIVATE SCREEN
  WAIT WINDOW NOWA "Hit ESC to terminate..."

  DO WHILE .T.
    
    .FORECOLOR=65535
    .CIRCLE(50, m.x + m.y * laCOS[m.Angle + 1], m.x + m.y * laSIN[m.Angle + 1])

    .FORECOLOR=65408
    .CIRCLE(50, m.x - m.y * laCOS[m.Angle + 1], m.x - m.y * laSIN[m.Angle + 1])

    .FORECOLOR=16711680
    .CIRCLE(50, m.x + m.y * laCOS[m.Angle + 91], m.x + m.y * laSIN[m.Angle + 91])

    .FORECOLOR=255
    .CIRCLE(50, m.x + m.y * laCOS[m.Angle + 271], m.x + m.y * laSIN[m.Angle + 271])

    *Advance drawing angle.
    IF m.Angle = 359
      Angle = 0
     ELSE
      Angle = m.Angle + 1
    ENDIF
    
    *Bounce the circles off the sides of the bounce area
    *by moving the initial center point around.
    IF m.x < m.lnMinX OR m.x > m.lnMaxX
      xdir = -1 * m.xdir
    ENDIF
    x = m.x + m.xdir

    IF m.y < m.lnMinY OR m.y > m.lnMaxY
      ydir = -1 * m.ydir
    ENDIF
    y = m.y + m.ydir

  ENDDO
ENDWITH

DO iquit

*-------------
  PROCEDURE iquit
  mywnd.CLS
  RELEASE mywnd
  RELEASE WINDOWS Superwnd
  SET CURSOR ON
  ON ESCAPE
  WAIT CLEAR
  CANCEL
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform