Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ideas for placing shapes around a circle
Message
From
18/05/2005 10:19:01
 
 
To
18/05/2005 03:12:06
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01015215
Message ID:
01015357
Views:
19
This message has been marked as a message which has helped to the initial question of the thread.
>I need to place a certain number of shapes inside a circular sector,
>to be clear : I need to figure the sits inside a circular theatre, I thought about the new syntax involving the poypoint and rotation property but I
>didn' find that much in the VFP Help.
>has anybody tested something similar ?
>Thx
>Alessio

Start a new Theatre game:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form


	desktop = .t.
	autocenter = .t.
	Height = 581
	Width = 765
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"


	PROCEDURE Init
		#define numero 20

		this.AddProperty([posti(numero)],null)

		stepAngle = 2*PI()/numero
		XCenter   = (this.width-60)/2
		YCenter	  = (this.height-60)/2
		radius	  = 200
		FOR k=1 TO numero
			this.AddObject("posti["+LTRIM(STR(m.k))+"]","Posto")
			WITH this.Controls[m.k]

				.Fillcolor = MOD(m.k,2)*255
				
				.Rotation = RTOD(stepAngle*m.k)

				.Move(m.XCenter - m.radius*COS(m.stepAngle*m.k),m.YCenter + m.radius*SIN(m.stepAngle*m.k))
				
				.Visible = .t.
			ENDWITH
		NEXT
        
        this.AddProperty([camerieri(3)],null)
        FOR k=1 TO 3
            this.AddObject("camerieri["+LTRIM(STR(m.k))+"]","maid")
        NEXT 
	ENDPROC

ENDDEFINE

DEFINE CLASS Posto AS Shape
	* is need a square
	heighT     = 60
	width	   = 60
 	backstyle  = 0
	FillStyle  = 0
	
	DIMENSION aPoints(4,2)
	aPoints			= 30
	aPoints[2,1]	= 70
	aPoints[3,1]	= 70
	aPoints[3,2]	= 70
	aPoints[4,2]	= 70
	PolyPoints		= "this.aPoints"
	
ENDDEFINE

DEFINE CLASS maid AS Image
    height = 64
    width  = 64
    backstyle  = 0
    Stretch = 1
    Picture = HOME(2)+"TASTRADE\BITMAPS\CALLLAUR.BMP"
    
    CountMove = 1
    Target  = 0
    
    PROCEDURE Init
        this.Move(thisform.Width/2,thisform.Height/2)
        ADDPROPERTY(m.this,"movetime",CREATEOBJECT("timer"))
        BINDEVENT(m.this.movetime,"Timer",this,"Moving")
        this.movetime.Interval = 100
        this.Visible = .T.
        
     PROCEDURE Moving
         IF m.This.CountMove=1
             this.Target       =INT(RAND()*numero)+1
             This.CountMove    = 5+INT(RAND()*10)
          ELSE
             this.CountMove = m.This.CountMove-1
         ENDIF
         DEBUGOUT  this.Target,THIS.CountMove
         WITH THISFORM.posti[m.this.Target]
             RETURN this.Move(THIS.Left+(.left-THIS.Left)/THIS.CountMove,THIS.Top+(.Top - THIS.Top)/THIS.CountMove)
        ENDWITH
ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform