Add the ability to drag and drop Doodads onto the level. The Doodad
buttons on the palette now trigger a Drag/Drop behavior when clicked,
and a "blueprint colored" version of the Doodad follows your cursor,
centered on it.
Actors are assigned a random UUID ID when they are placed into a level.
The Canvas gained a MaskColor property that forces all pixels in the
drawing to render as the same color. This is a visual-only effect, and
is used when dragging Doodads in so they render as "blueprints" instead
of their actual colors until they are dropped.
Fix the chunk bitmap cache system so it saves in the $XDG_CACHE_FOLDER
instead of /tmp and has better names. They go into
`~/.config/doodle/chunks/` and have UUID file names -- but they
disappear quickly! As soon as they are cached into SDL2 they are removed
from disk.
Other changes:
- UI: Add Hovering() method that returns the widgets that are beneath
a point (your cursor) and those that are not, for easy querying
for event propagation.
- UI: Add ability to return an ErrStopPropagation to tell the master
Scene (outside the UI) not to continue sending events to other
parts of the code, so that you don't draw pixels during a drag
event.
Adds the first features to Edit Mode to support creation of Doodad
files! The "New Doodad" button pops up a prompt for a Doodad size
(default 100px) and configures the Canvas widget and makes a Doodad
struct instead of a Level to manage.
* Move the custom Canvas widget from `level.Canvas` to `uix.Canvas`
(the uix package is for our custom UI widgets now)
* Rename the `doodads.Doodad` interface (for runtime instances of
Doodads) to `doodads.Actor` and make `doodads.Doodad` describe the
file format and JSON schema instead.
* Rename the `EditLevel()` method to `EditDrawing()` and it inspects the
file extension to know whether to launch the Edit Mode for a Level or
for a Doodad drawing.
* Doodads can be edited by using the `-edit` CLI flag or using the
in-game file open features (including `edit` command of dev console).
* Add a `Scrollable` boolean to uix.Canvas to restrict the keyboard
being able to scroll the level, for editing Doodads which have a fixed
size.
* Edit Mode now uses the Level object itself to keep the drawing data
rather than pull its Palette and Chunks out, so it can hang on to more
information. The Canvas widget is given references to the
Level.Palette and Level.Chunker via Canvas.LoadLevel()
* Fix the handoff between Edit Mode and Play Mode. They pass the Level
object back and forth and the Filename, because it's not part of the
Level. You can save the map with its original settings after returning
from Play Mode.
* Fix the collision detection in Play Mode. It broke previously when
palettes were added because of the difference between a render.Point
and a level.Pixel and it couldn't easily look up coordinates. The new
Chunker system provides a render.Point lookup API.
* All pixels are solid for collision right now, TODO is to return Swatch
information from the pixels touching the player character and react
accordingly (non-solid, fire flag, etc.)
* Remove the level.Grid type as it has been replaced by the Chunker.
* Clean up some unused variables and functions.
* Add ui.Window to easily create reusable windows with titles.
* Add a palette window (panel) to the right edge of the Edit Mode.
* Has Radio Buttons listing the colors available in the palette.
* Add palette support to Edit Mode so when you draw pixels, they take
on the color and attributes of the currently selected Swatch in your
palette.
* Revise the on-disk format to better serialize the Palette object to
JSON.
* Break Play Mode: collision detection fails because the Grid key
elements are now full Pixel objects (which retain their Palette and
Swatch properties).
* The Grid will need to be re-worked to separate X,Y coordinates from
the Pixel metadata to just test "is something there, and what is
it?"
* Add a debug view that draws the player bounding boxes.
* Improve the collision detection to add support for:
* Doodads being "Grounded" so gravity need not apply.
* Walking up hills, albeit a bit "bouncily"
* Harder to clip out of bounds
Known bugs:
* The Pixel format in the Grid has DX and DY attributes and
it wreaks havoc on collision detection in Play Mode when you
come straight from the editor. Reloading the map from disk to
play is OK cuz it lacks these attrs.