Displaying rectangles in game window with XNA
Posted
by blerh
on Stack Overflow
See other posts from Stack Overflow
or by blerh
Published on 2010-05-08T21:42:43Z
Indexed on
2010/05/10
6:34 UTC
Read the original article
Hit count: 257
I want to divide my game grid into an array of rectangles. Each rectangle is 40x40 and there are 14 rectangles in every column, with a total of 25 columns. This covers a game area of 560x1000.
This is the code I have set up to make the first column of rectangles on the game grid:
Rectangle[] gameTiles = new Rectangle[15];
for (int i = 0; i <= 15; i++)
{
gameTiles[i] = new Rectangle(0, i * 40, 40, 40);
}
I'm pretty sure this works, but of course I cannot confirm it because rectangles do not render on the screen for me to physically see them. What I would like to do for debugging purposes is to render a border, or fill the rectangle with color so I can see it on the game itself, just to make sure this works.
Is there a way to make this happen? Or any relatively simple way I can just make sure that this works?
Thank you very much.
© Stack Overflow or respective owner