1
0
Fork 0

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 2019-07-03 16:22:30 -07:00
commit 8126888b5b
1 arquivos alterados com 4 adições e 3 exclusões

Ver arquivo

@ -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:
case sdl.SCANCODE_LCTRL:
case sdl.SCANCODE_RCTRL:
continue
case sdl.SCANCODE_LCTRL:
s.ControlActive.Push(t.State == 1)
case sdl.SCANCODE_RCTRL:
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 {