Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

GravtyKlz

drawing board

This topic is 5621 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im trying to draw a checkers board, but for some reason the first column of blocks are a little wider than the rest
for(i=0;i<8;i++)
	{
	for(j=0;j<8;j++)
        {	
	      if (i == 0 || i == 2 || i == 4 || i == 6 || i == 8)
		{
			if (j == 0)
				fl = 0;
			else 
				fl +=200;
			
			ft = (71*i);
		
			fr = fl + 100;
			fb = ft+71;
			
			rc.left = fl;
			rc.right = fr;
			rc.bottom = fb;
			rc.top = ft;
			FillRect(hdc, &rc, black_brush);
		}
		else
		{
			if (j == 0)
				fl = 100;
			else 
				fl +=200;
			
			ft = (71 * i);
			fr = fl +100;
    		       fb = ft +71;
			rc.left = fl;
			rc.right = fr;
			rc.bottom = fb;
			rc.top = ft;
			FillRect(hdc, &rc, black_brush);
		}
	}
}
 
I initially tried the if statement as if(i%2 || i == 0) but it didnt work so I did it that long way. Anyways the board comes out perfect except for that first column.

Share this post


Link to post
Share on other sites
Advertisement
I found my own problem. The edges of the screen are black and that makes all the blocks on the edges look bigger. I fixed it by making a white border around the window. I''m still wondering why if(i%2 || i == 0) didnt work though.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!