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.
This commit is contained in:
parent
e682bb27c0
commit
8126888b5b
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user