Save the tile painted on screen.

BlitzPlus Forums/BlitzPlus Programming/Save the tile painted on screen.

Valgar(Posted 2003) [#1]
I think i'm about to make all the forum full of my question(sorry for that...)
Actually i have a code that create a grid of 2000*2000 pixel,move the mouse with an image tha i select from a directory,and with a "typed" tile image i paint them with the mouse button....
I create many background with this code but when i finish to paint...all i have is my code o_O''
I'm thinking to make a function that save my painted "map".
But what is the best manner to save a work like mine?
I have thinking that if i write in a file all the coordinates of every single tile and later include this file would a greath idea but it's too expensive to write the saves in this manner.....
I think that put the coordinates in an array is the best way,but don't know how to use array well enough ^^
Are there other methods to achieve this sort of save?
(another time sorry for making so much posts)


JazzieB(Posted 2003) [#2]
If you draw your picture to an ImageBuffer then you can save it with...

SaveBuffer(ImageBuffer(image_handle),"picture.bmp")


To save the FrontBuffer use...

SaveBuffer(FrontBuffer(),"picture.bmp")


However, it's worth pointing out that older graphics cards have problems working with images larger than the current screen resolution. If you plan on others using your program, it's best to avoid large images altogether.


Valgar(Posted 2003) [#3]
Yes i have tried it myself but it saves an "images".
But i want to save not the image buffer,but the object i paint,with their coordinates and all...something like saving a map data.
I have read many tutorial but.....i didn't figured out how can i save my work.


Anthony Flack(Posted 2003) [#4]
Perhaps an array, or type structure, that records the position of the mouse every time you do a mouseclick (or similar) - then you save this data, and when you load it back in, the computer replays it all as quickly as it can manage it, reconstructing what you did the first time, only really quickly...


cyberseth(Posted 2003) [#5]
I'd say: Every time you create a tile on the screen, make a new type which holds the coordinates of the tile and the number of its tile image. Then, when you want to save. Go through every type and save its data. When loading back, load all the coordinates and their data and create all the tiles again.