void swap(int *a,int *b)

{

int *t;

*t = *a;

*a = *b;

*b = *t;

}

int x,y,x1=0, y10=0 ,x2=100,y2=100,e,dy,dx,absolute; //declared at global scope, not member of class

void Client::calculating()

{

if(x1>x2)

{

swap(&x1,&x2);

swap(&y10,&y2);

}

x = x1;

y = y10;

if((y2-y10)<0)

absolute = -1;

else

absolute = 1;

dy = absolute*(y2-y10);

dx = x2-x1;

//usleep(1000*1000*1);

e = (2*dy)-dx;

while( x < x2)

{

emit startSending(x,y);

x = x+1;

if(e<0)

e = e+(2*dy);

else

if (y10>y2)

{

y = y-1;

e = e+(2*dy)-(2*dx);

}

else

{

y = y+1;

e = e+(2*dy)-(2*dx);

}

}

}

void swap(int *a,int *b)
{
int *t;
*t = *a;
*a = *b;
*b = *t;
}
int x,y,x1=0, y10=0 ,x2=100,y2=100,e,dy,dx,absolute; //declared at global scope, not member of class
void Client::calculating()
{
if(x1>x2)
{
swap(&x1,&x2);
swap(&y10,&y2);
}
x = x1;
y = y10;
if((y2-y10)<0)
absolute = -1;
else
absolute = 1;
dy = absolute*(y2-y10);
dx = x2-x1;
//usleep(1000*1000*1);
e = (2*dy)-dx;
while( x < x2)
{
emit startSending(x,y);
x = x+1;
if(e<0)
e = e+(2*dy);
else
if (y10>y2)
{
y = y-1;
e = e+(2*dy)-(2*dx);
}
else
{
y = y+1;
e = e+(2*dy)-(2*dx);
}
}
}

*To copy to clipboard, switch view to plain text mode *

## Bookmarks