jakethesnake
|
 |
«
Posted
2014-08-13 06:00:11 » |
|
Couldn't really make a good title there...
I have a map consisting of 1000*1000 tiles, which are 32pixels'32pixels. I've managed to draw these on a dedicated space on the screen and implemented a scrolling system and a zoom. Now I want to make a minimap on the corner of the screen, showing the whole map. The problem is I can't iterate through my tiles on every render call, scale them down and draw them, it will take too much resources. Instead I thought the game would "draw" a picture when loading, so that the full iteration only has to be done once. problem is I don't know how to create an image, then draw stuff on it and save it in the memory. Here's some psydo-code of what I have in mind.
class Minimap{
//the image I'll use. Image minimap;
//constructor Minimap (){
minimap = new Image ("desired width", "desired height");
for (every tile that's on the actual "real" map) minimap."draw a rectangle and then save it"(x,y,color,width,height);
now the minimap should be good to go. Every time I render it, it will be just like drawing a single image.
I hope my question makes sense.
|