I am making a small game as sort of a test project, nothing major. I just started and am working on the graphics piece, but I’m not sure the best way to draw the graphics to the screen.
It is going to be sort of like the old Zelda, so pretty simple using bitmaps and such. I started thinking that I could just paint to a Picture Box control using Drawing.Graphics with the Handle from the control, but this seems cumbersome. I’m also not sure if I can use double buffering with this method either.
I looked at XNA, but for now I wanted to use a simple method to display everything.
So, my question. Using the current C# windows controls and framework, what is the best approach to displaying game graphics (i.e. Picture Box, build a custom control, etc.)
EDIT:
I will add how I am currently drawing to the picture box. I have a Tile object that just contains the pixels for the tile ( List< List< Color>> texture; ), nothing more for simplicity. I then draw that to the pic box by iterating through the pixels and using the FillRectangle method using a brush with the current pixel color and the size specified by a scale 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));
}
}
Yah, pretty cumbersome. Any suggestions or comments are appreciated.
I would recommend, that you take another look at XNA and try a few samples. It is really simple to make simple games with XNA as long as you stick with 2D. The framework does an excellent job at wrapping all the details in a easy to understand flow, where you basically fill in the blanks so to speak.
I did a complete (but very simple) Xbox game for my son in just 8 hours without little previous experience.
If you move to 3D things become more complex, as you have to understand various view models, shaders and so forth, but for 2D it is really simple to get started.
Another advantage of 2D is that the required tools are easier to get. I did all the graphics using Photoshop, the sounds were MP3s and voices I recorded using the Windows recorder. For 3D you need complex tools for building and exporting models and so forth.