Add the JSON format for embedding Actors (Doodad instances) inside of a
Level. I made a test map that manually inserted a couple of actors.
Actors are given to the Canvas responsible for the Level via the
function `InstallActors()`. So it means you'll call LoadLevel and then
InstallActors to hook everything up.
The Canvas creates sub-Canvas widgets from each Actor.
After drawing the main level geometry from the Canvas.Chunker, it calls
the drawActors() function which does the same but for Actors.
Levels keep a global map of all Actors that exist. For any Actors that
are visible within the Viewport, their sub-Canvas widgets are presented
appropriately on top of the parent Canvas. In case their sub-Canvas
overlaps the parent's boundaries, their sub-Canvas is resized and moved
appropriately.
- Allow the MainWindow to be resized at run time, and the UI
recalculates its sizing and position.
- Made the in-game Shell properties editable via environment variables.
The kirsle.env file sets a blue and pink color scheme.
- Begin the ground work for Levels and Doodads to embed files inside
their data via the level.FileSystem type.
- UI: Labels can now contain line break characters. It will
appropriately render multiple lines of render.Text and take into
account the proper BoxSize to contain them all.
- Add environment variable DOODLE_DEBUG_ALL=true that will turn on ALL
debug overlay and visualization options.
- Add debug overlay to "tag" each Canvas widget with some of its
details, like its Name and World Position. Can be enabled with the
environment variable DEBUG_CANVAS_LABEL=true
- Improved the FPS debug overlay to show in labeled columns and multiple
colors, with easy ability to add new data points to it.
* Increase the default window size from 800x600 to 1024x768.
* Move the drawing canvas in EditorMode to inside the EditorUI where it can
be better managed with the other widgets it shares the screen with.
* Slightly fix Frame packing bug (with East orientation) that was causing
right-aligned statusbar items to be partially cropped off-screen. Moved a
couple statusbar labels in EditorMode to the right.
* Add `Parent()` and `Adopt()` methods to widgets for when they're managed
by containers like the Frame.
* Add utility functions to UI toolkit for computing a widget's Absolute
Position and Absolute Rect, by crawling all parent widgets and summing
them up.
* Add `lib/debugging` package with useful stack tracing utilities.
* Add `make guitest` to launch the program into the GUI Test.
The command line flag is: `doodle -guitest`
* Console: add a `close` command which returns to the MainScene.
* Initialize the font cache directory (~/.cache/doodle/fonts) but don't
extract the fonts there yet.
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.
* Added a "menu toolbar" to the top of the Edit Mode with useful buttons
that work: New Level, New Doodad (same thing), Save, Save as, Open.
* Added ability for the dev console to prompt the user for a question,
which opens the console automatically. "Save", "Save as" and "Load"
ask for their filenames this way.
* Started groundwork for theming the app. The palette window is a light
brown with an orange title bar, the Menu Toolbar has a black
background, etc.
* Added support for multiple fonts instead of just monospace. DejaVu
Sans (normal and bold) are used now for most labels and window titles,
respectively. The dev console uses DejaVu Sans Mono as before.
* Update ui.Label to accept PadX and PadY separately instead of only
having the Padding option which did both.
* Improvements to Frame packing algorithm.
* Set the SDL draw mode to BLEND so we can use alpha colors properly,
so now the dev console is semi-translucent.
* 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?"
* Added `BoxSize()` to Widget that reports the full box size including
borders and margin.
* The Frame uses the `BoxSize()` of widgets to position them.
Reintroduces some padding issues (boxes on the GUI Test stick out of
bounds a bit) but is on the right track.
* Renamed `Padding` to `Margin` on the Widget object, since the Margin
is taken into consideration along with Outline and Border in computing
the widget's BoxSize.
* Restructured the Label widget to take a Text or TextVariable property
and the font settings (render.Text) are in a new `Font` property.
* The shell now supports an "eval" command, or "$" for short.
* Runs it in an Otto JavaScript VM.
* Some global variables are available, like `d` is the Doodle object
itself, `log`, `RGBA()` and `Point()`
* The shell supports paging through input history using the arrow keys.
* Added an initial Main Scene
With Labels and Buttons so far.
* Labels are pretty much complete, they wrap a render.Text and have a
Compute() method that returns their Width and Height when rendered
onto an SDL Surface.
* Buttons wrap a Label widget and Compute() its size and takes that into
consideration when rendering itself. Buttons render themselves from
scratch in a "Windows 95" themed way, with configurable colors, border
widths and outline.
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.
Implements the dev console in-game with various commands to start out
with.
Press the Enter key to show or hide the console. Commands supported:
new
Start a new map in Edit Mode.
save [filename.json]
Save the current map to disk. Filename is required unless you
have saved recently.
edit filename.json
Open a map from disk in Edit Mode.
play filename.json
Play a map from disk in Play Mode.
First pass at a level storage format to save and restore maps.
To save a map: press F12. It takes a screenshot PNG into the
screenshots/ folder and outputs a map JSON in the working directory.
To restore a map: "go run cmd/doodle/main.go map.json"