Skip to main content
gamedev.net
🔒 Locked

Win32 Pie Function

Started by gp343 Jun 11, 2002 at 9:04 AM 0 replies 1.1k views
Original Post
gp343
gp343
Can somebody please rewrite the Pie function in the WIN32APIfrom: procedure Pie(HDC hdc; int x1, Y1, X2, Y2, X3, Y3, X4, Y4); to look like this. procedure Pie(HDC hdc; int x,y,width,height,startAngle,arcAngle); I''m not good at mathematics and find the pie function of WIN32API too difficult to manipulate. Java has got a much more user friendly drawArc method that is much more easier to use. Please help Thanks James
doctorsixstring
doctorsixstring
Just so you know, I doubt there are many people on this forum
that will simply write the code for you. But I'm kind of bored,
so I'll see what I can throw together: What you probably want to
do, is simply write a wrapper function, like this:



    
void PieEx(HDC hdc, int x,y,width,height,startAngle,arcAngle)
{

POINT ptRadial1 = {...};
POINT ptRadial2 = {...};

/*
do math to determine position of radial endpoints, given the
startAngle and arcAngle. Basically, just use the startAngle
from the XY coordinate to determine the position of Radial One,
and startAngle+arcAngle to determine the position of Radial Two.
You need to use sines and cosines of the given angles to
determine the x and y distances to the radial coords.
*/


Pie(hdc, x-width/2, y-height/2, x+width/2, y+height/2,
ptRadial1.x, ptRadial1.y, ptRadial2.x, ptRadial2.y );
}



[edited by - doctorsixstring on June 11, 2002 11:15:14 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.