I'm working on a procedurally generated game, and I want to have the ability to draw a map of the terrain. I've been able to do this with the attached code I have, and it works exactly how I want it to, but it absolutely tanks the framerate. The problem is that the code is continually running over and over, so it keeps re-drawing the map, which is obviously a drain on resources.
Is there any way that I can either have the loop run once, draw the map out as I want to, and then keep drawing without continually running the loop? Or is there maybe a way I can save all of the rectangles to a bitmap and just draw that instead?
I haven't worked too deeply with the "When Drawing" events, so this may be a simple fix, but I'm just a bit stumped with it right now. Any help is of course very appreciated!
EDIT: Googling around, I found this:
http://blog.stencyl.com/?p=1411 It's dated a little while back, but it seems like it would be able to handily solve my issue. Is that still under development right now, or can it be downloaded somewhere?
EDIT 2: I'm dumb. I didn't realize there was the entire section in Sounds and Images. I'll continue working on this myself, but if anyone wants to point me in the direction of a tutorial, or wants to have a go at figuring out my map problem for me, feel free!
EDIT 3: OK! So, after running the loop to create the map image, I set an image attribute to the current screen, and then set the image attribute to just be the part of the screenshot that contained the map. Then, I just set an image instance to that image, and displayed it in the same spot as the original map. The Image API is the coolest thing ever! Thanks for the help, folks.