Browse Source

Drawing Strokes and Undo/Redo Functionality

* Add new pkg/drawtool with utilities to abstract away drawing actions
  into Strokes and track undo/redo History for them.
* The freehand Pencil tool in EditorMode has been refactored to create a
  Stroke of Shape=Freehand and queue up its world pixels there instead
  of directly modifying the level chunker in real time. When the mouse
  button is released, the freehand Stroke is committed to the level
  chunker and added to the UndoHistory.
* UndoHistory is (temporarily) stored with the level.Level so it can
  survive trips to PlayScene and back, but is not stored as JSON on
  disk.
* Ctrl-Z and Ctrl-Y in EditorMode for undo and redo, respectively.
master
Noah Petherbridge 1 year ago
parent
commit
8126888b5b
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      sdl/events.go

+ 3
- 2
sdl/events.go View File

@@ -146,12 +146,13 @@ func (r *Renderer) Poll() (*events.State, error) {
case sdl.SCANCODE_LSHIFT:
case sdl.SCANCODE_RSHIFT:
s.ShiftActive.Push(t.State == 1)
continue
case sdl.SCANCODE_LALT:
case sdl.SCANCODE_RALT:
continue
case sdl.SCANCODE_LCTRL:
s.ControlActive.Push(t.State == 1)
case sdl.SCANCODE_RCTRL:
continue
s.ControlActive.Push(t.State == 1)
case sdl.SCANCODE_BACKSPACE:
// Make it a key event with "\b" as the sequence.
if t.State == 1 || t.Repeat == 1 {


Loading…
Cancel
Save