Polygon control 
Author Message
 Polygon control

Hi

Is it possible to make a custom control class in RB with a user defined
shape of a polygon?
Gerard Jonker
The Netherlands



Wed, 12 Dec 2001 03:00:00 GMT  
 Polygon control
yes it is,

you need to define your class and make the Canvas control its superclass

Floris

Quote:

> Hi

> Is it possible to make a custom control class in RB with a user defined
> shape of a polygon?
> Gerard Jonker
> The Netherlands



Thu, 13 Dec 2001 03:00:00 GMT  
 Polygon control
Hi Floris

Thanks for the reply but can you please give me more details.
I need this control for a puzzle game where all the peaces are polygon shaped with
the possibility for the user te pick it up with the mouse and move it across the
screen.
I made the same game with SuperCard but  I like to convert it to RB.

Gerard Jonker

Quote:

> yes it is,

> you need to define your class and make the Canvas control its superclass

> Floris


> > Hi

> > Is it possible to make a custom control class in RB with a user defined
> > shape of a polygon?
> > Gerard Jonker
> > The Netherlands



Thu, 13 Dec 2001 03:00:00 GMT  
 Polygon control

Quote:

> Hi Floris

> Thanks for the reply but can you please give me more details.
> I need this control for a puzzle game where all the peaces are polygon
> shaped with the possibility for the user te pick it up with the mouse and
> move it across the screen.
> I made the same game with SuperCard but  I like to convert it to RB.

> Gerard Jonker

        Gerard --

        I haven't tried this myself, but what might work is writing a
simple routine which determines whether a given position is inside or
outside the polygon's boundaries.  Then, call that routine in the
polygon-control's MouseDown event to find out whether this polygon
should handle the event or pass it on.

        -jc

--

* Home page:  http://members.tripod.com/~afeldspar/index.html
*          The home of >>Failed Pilots Playhouse<<
* "Better you hold me close than understand..."  Thomas Dolby



Thu, 13 Dec 2001 03:00:00 GMT  
 Polygon control
Use the DrawPolygon and FillPolygon methods of the graphics object.

To be able to drag polygon shaped canvases (like SuperCard polygon
shaped buttons) around the window, you can shrink the canvas to
the minimum values needed to 'box' in the polygon, or you can use
an algorithm to test whether the mouse is within the polygon or not.

I was going to release a free polybutton class, but I haven't had
time to finish it yet.  You can check out what I've got so far
though at this URL:
http://www.playground.ltc.vanderbilt.edu/~holtondl/basic/polybutton.sit.
hqx

The algorithm for testing if a point is within a polygon is in the
'withinpoly' method of the class.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Fri, 14 Dec 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. area of a polygon

2. Challenge: Area of a Polygon

3. Challenge: Area of a polygon

4. Polygon rotation

5. Polygon

6. PIE and POLYGON

7. POLYGON & PIE 32bit

8. Polygon Broke? (CW 2.003)

9. How Do I delete a POLYGON

10. Polygon(corners) - problem....

11. Rectangular Polygons?

12. Vectored Polygons

 

 
Powered by phpBB® Forum Software