I make a small game as a kind of test project, nothing serious. I’ve just started and am working on graphics, but I’m not sure what the best way to draw graphics on the screen.
It will be similar to the old Zelda, so rather simple use of bitmaps, etc. I started thinking that I could just draw a Picture Box control using Drawing.Graphics with a pen from the control, but that seems cumbersome. I am also not sure if I can use double buffering with this method.
I looked at XNA, but now I wanted to use a simple method to display everything.
So my question. Using the current Windows C # controls and frameworks, what is the best approach to displaying game graphics (i.e. Picture Box, creating a custom control, etc.).
EDIT: I will add how I am currently drawing the image. I have a Tile object that just contains pixels for a tile ( List< List< Color>> texture; ), nothing more for simplicity. Then I draw this in the pic field, iterating through the pixels and using the FillRectangle method, using a brush with the current pixel color and the size given by the zoom variable:
int scale = 5;
for (int i = 0; i < texture.Width;)
{
for (int j = 0; j < texture.Height; ++j)
{
int x = i * scale;
int y = j * scale;
picBox.FillRectangle(new SolidBrush(currentPixelColor), new Rectangle(x, y, scale, scale));
}
}
Yes, pretty bulky. Any suggestions or comments are appreciated.
source
share