I know I just posted a post asking for help on a different subject, but I've narrowed down what I am confused about. I don't fully understand how the x++ and y++ commands work. Here is example coding:
Code: Select all
int y = boxY;
while( y < boxY + boxWidth )
{
int x = boxX;
while( x < boxX + boxWidth )
{
gfx.PutPixel( x,y,255,255,255 );
x++;
}
y++;
}
}
This creates a square, and I understand how everything works, except how the x++ and y++ commands make the entire square. With this coding I would expect the computer to draw a line from the PutPixel coordinates right, along the x axis, until it hits boxX + boxWidth, and draw a line down, along the y axis, until it hits boxY + boxWidth, and not fill in the rest of the square.
How is the rest of the square filled in with this simple command?
Thanks!