* 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.
CheckButton is a generic component based on Button that additionally
takes a *bool variable to manage. When the CheckButton is clicked or
unclicked, it will toggle the bool var and its border style will "stick"
in or out depending on the state.
Checkbox is a Frame widget that wraps a CheckButton and another child
widget, such as a Label. Interacting with the child widget will forward
all of its mouse events to the CheckButton, so that the Label could be
clicked instead of just the box itself.
* Frame.Pack() now supports Fill and Expand and works like Tk.
* The GUITest Scene now draws a large window with two fixed side panels,
an expanding body panel, and a fixed footer with buttons. The panels
are filled with other buttons and widgets showing off the Frame
packing.
These properties will be globally useful to all sorts of Widgets and
have been moved from the Button up into the Common widget, and its
interface extended to configure these:
* Padding int32
* Background color
* Foreground color
* Border size, color and style (default solid; raised; sunken)
* Outline size and color
The button adjusts its border style from "raised" to "sunken" for
MouseDown events and its Background color for MouseOver events. Other
widgets such as Labels and Frames will be able to have borders, paddings
and outlines too, but they will be off by default.
The Buttons can now be managed by a ui.Supervisor and be notified when
the mouse enters or leaves their bounding box and handle click events.
Current event handlers supported:
* MouseOver
* MouseOut
* MouseDown
* MouseUp
* Click
Each of those events are only fired when the state of the event has
changed, i.e. the first time the mouse enters the widget MouseOver is
called and then when the mouse leaves later, MouseOut is called.
A completed click event (mouse was released while pressed and hovering
the button) triggers both MouseOut and Click, so the button can pop
itself out and also run the click handler.
* 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.
* 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.
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"