I am working on a kind of 2D game engine. The engine itself is a separate thread running in a loop and calling a renderer function. This functions renders the current game situation from scratch each loop. It all works fine with small objects. I can move a character, add/remove obkect dynamically, detect collisions, and much more.
The problem is that I now added a 8000 x 8000 pixel background and the whole thing collapses. That is a large image but not extreme. right?
The "g.DrawImage(BGImage,new Point(0,0));" function just takes a lot of time and totally wrecks my renderer thread. the same code with a much smaller bg image runs fine. So g.DrawImage seems to be not able to handle large images.
The image drawn is already in an Image object. Loaded only once via BGImage = new Bitmap(Image.FromFile(BGImagePathAndFile));
The reason for using one large image file is that I use g.rotate/Scale/TranslateTransform functions to zoom in/out and pan around on the game field. My objects are pinned to pixel coordinates on that (large) background image.
What would be a good approach to handle this?
Is there a way to only g.DrawImage() my background once and use that as a starting point for each consecutive render?
Any other advice?