So Ive been using surfaces lately. Im trying to figure how to make undos+redos but I cant quite get it.
I draw on the surface in the mouse left button event. I make a new surface each time I realease it, storing the previous surface in an array. I then draw the previous surface onto the new surface, setting the new one to the currently drawn surface. But when going back the drawing never changes. Here my code-Create-surs=1cur_sur=1sur[cur_sur]=surface_create(room_width,room_height)surface_set_target(sur[cur_sur])draw_clear(c_white)surface_reset_target()Global left-surface_set_target(sur[cur_sur])draw_circle(mouse_x,mouse_y,5,0)surface_reset_target()Global left released-surs+=1cur_surs=surssur[cur_surs]=surface_create(room_width,room_height)surface_set_target(sur[cur_surs])draw_surface(sur[cur_surs-1],0,0)surface_reset_target()Draw-draw_surface(sur[cur_sur],0,0)Down-cur_sur-=1<a href='http://64digits.com/users/Kaz/undo.gm6'>File</a>Anyone care to help?If you remember I was going on a trip to NJ. But my moms been busy and hasnt been able to look at the train schedule yet. So Im going after the concert(August 7th).
I should probably learn to use surfaces… Hmm… Nah. Right now I'm working on data structures. Sorry I can't help.
Wheres FredFredrickson when you need him?
Taking a quick glance at the coding and it all seems perfect.
Maybe there's another way of doing undos and redos.Yes the code looks fine, but when you try it its definetly not fine.
<a href='http://64digits.com/users/Kaz/undo.gm6'>File</a>I would try it out by computer is Game Makerless.
Worked just fine for me after I implemented the code into a very early version of my Linked paint program, but I had to press down twice before it started subtracting versions of my work.
Try <a href="http://www.64digits.com/download.php?name=undo_fix.gm6&id=7426">this</a>
I hacked up your code a little bit, and the up arrow no longer works, but if you draw a few lines and then press down it will indeed get rid of them. My theory is that somewhere you've jacked up the current vs number of surfaces. I would recommend using lists or something besdies arrays though, which would let you more easily (and quickly) add and remove instances of surfaces in the memory, so you only have about 10 undo levels max.