1 min read

What are the keyboard shortcuts for undo and redo functions in game development?

Keyboard Shortcuts Overview

Common Shortcuts

  • Undo: Ctrl + Z (Windows) / Command + Z (Mac)
  • Redo: Ctrl + Y / Ctrl + Shift + Z (Windows) / Command + Y (Mac)

Implementation Example

class ActionManager {
    Stack<Action> undoStack = new Stack<>();
    Stack<Action> redoStack = new Stack<>();
    
    public void undo() {
        if (!undoStack.isEmpty()) {
            Action action = undoStack.pop();
            action.undo();
            redoStack.push(action);
        }
    }
    
    public void redo() {
        if (!redoStack.isEmpty()) {
            Action action = redoStack.pop();
            action.redo();
            undoStack.push(action);
        }
    }
}

Useful Resources