So , I've been obsessing about this for a while , as stupid as it may sound , I don't seem to know where exactly can I declare functions when I'm Drawing in VC++ 2008 , all I did so far was initialize paint Handle , wrote a couple lines in it and a line was drawn , I thought : "fantastic! , now let's do recursions!" , turned out not quite as easy as I imagined , so if anyone would help I'd be grateful.
The function is listed below , just tell me where am I supposed to declare it and if you have some extra time on your hands , how can I declare a header containing it .
void DrawTemplate(int level,float X,float Y,float length,float angle) {
if (level != 0) {
float newx;float newy;
newx = X+cos(angle)*length;
newy = Y-sin(angle)*length;
formGraphics->DrawLine(myPen,X ,Y, newx, newy);
X=newx;Y=newy;
newx = X+sin(angle)*length;
newy = Y+cos(angle)*length;
formGraphics->DrawLine(myPen,X ,Y, newx, newy);
X=newx;Y=newy;
newx = X-cos(angle)*length;
newy = Y+sin(angle)*length;
formGraphics->DrawLine(myPen,X ,Y, newx, newy);
X=newx;Y=newy;
newx = X-sin(angle)*length/2;
newy = Y-cos(angle)*length/2;
formGraphics->DrawLine(myPen,X ,Y, newx, newy);
void DrawTemplate(int level--,newx,newy,length/2,angle-(pi/4));
X=newx;Y=newy;
newx = X-sin(angle)*length/2;
newy = Y-cos(angle)*length/2;
formGraphics->DrawLine(myPen,X ,Y, newx, newy);
}
}
P.S 1: I'm only a beginner.
P.S 2 : Thanks in advance.
Another P.S : You don't even have to read the code ,just tell me where can I put it and I'd be thankful.