Undo/Redo

Published June 04, 2007
Advertisement
Hello. Got some progress to show today. Woho. First of all, a thanks to Reiner for making free tile sets to use, I'm currently using one to see what I'm doing.

Here are three screenshots of my progress(click them to see full size):
Screen 1
Here you see the grid, the snap to grid works too. Really easy to make maps fast, will go even faster when I get Undo/Redo up and running, but more about that later.


Screen 2
Here you can see the info box in action, called Navigator in photoshop. Took a while to get it right, but now it works perfectly. The red box follows the what is shown in the form, zoom doesn't work yet but when it does the info box will show that too.


Screen 3
Not much new here, a saved map. We can give the history and layers forms a little attention to then. The names are kind of self-explanatory but well the history form is what is getting the most attention now, it will work so that every action you do can be undone, and also reverted back to in one jump. The layer form will basically show all the layers on the map and enable editing in form of layer order manipulation and such.


Undo and Redo
Now this is my mission, I think I will try the memento pattern.
I will make a interface of an action that all action that you can do in the editor will inherit from, and a history class that keeps a undo and a redo stack of actions. When I pop a state from the undo stack I push it onto the redo stack and the other way around if I redo.
The tricky part I think will be representing actions. I could represent a addTile action with a copy of the tile added, but this will skyrocket my memory usage I guess. I will have to think about this for a while before I begin to code. Suggestions are always welcome [smile].

Well that was this for this day, I hope to be able to do these kind of updates a couple of times a week. Bye to then!
Previous Entry Change of plans
0 likes 2 comments

Comments

takingsometime
Your approach to the list of actions sounds pretty good to me. I've been thinking of doing it this way for a while in my own editors, but have yet to implement it [smile]. I had planned that the interface would define methods for do/undo/redo, and each operation (addtile, etc.) would just contain the instructions for executing the methods (e.g. add tile index 14 to grid pos 3,4). I would have a fixed length for the history of actions (probably around 100 or so), given that you're unlikely to go back too far in the history to make changes. Just my $0.02.
June 04, 2007 08:46 PM
walle
My thoughts was not to have a fixed lenght of the history, or perhaps just use a circular history, so if you edit to much you can't go back, unless to the initial state oufcource. But not shure yet.
June 05, 2007 04:17 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Pissed (again)

909 views

Damn IE!

895 views

Undo / Redo done

999 views

Undo/Redo

1144 views

Change of plans

837 views

Here's the list

943 views

Minor update

994 views

Some progress

987 views
Advertisement