SDK Question Polygons and IVECTOR2

markl316

XR2 Ravenstar Commander
Addon Developer
Tutorial Publisher
Joined
Mar 30, 2008
Messages
450
Reaction score
2
Points
18
Hi,

I'm trying to draw a triangle on an MFD. After a few hours of searching google, the forum, and the API documentation, I can't seem to find any examples of implementation of the Polygon function in a sketchpad.

Code:
virtual void Polygon (const IVECTOR2 *pt, int npt) // function definition from the orbiter API reference

skp->Polygon (??, 3); // implementation in my MFD code

I'm a bit confused by this function, as it seems that you'd need multiple IVECTOR2's to store the multiple point locations of the polygon. Does anybody have an example of an implementation of this function?
 
I'm a bit confused by this function, as it seems that you'd need multiple IVECTOR2's to store the multiple point locations of the polygon. Does anybody have an example of an implementation of this function?

Make an array of IVECTOR2 values and pass it... just that. I am sure I have an example somewhere at home.
 
That did the trick, thanks!!

Code:
// Draw a right triangle in the upper left corner of an MFD
oapi::IVECTOR2 pt1, pt2, pt3;
pt1.x = 2; pt1.y = 2;
pt2.x = 65; pt2.y = 65;
pt3.x = 2; pt3.y = 65;

oapi::IVECTOR2 ptarr[3] = {pt1,pt2,pt3};
skp->Polygon(ptarr, 3);
 
Back
Top