* New and completed widgets: Menu, MenuButton and MenuBar.
* MenuButton is a kind of Button that opens a popup Menu when clicked.
* MenuBar is a container of buttons designed to be attached to the top
of an application window ("File, Edit, View, Help")
* Supervisor manages the popup menus with its new concept of a Modal
Widget. Modal widgets take exclusive event priority for all mouse and
key events. The pop-up menu is a modal window, which means you must
click an option inside the menu OR clicking outside the menu will
close it and eat your click event (widgets outside the modal don't
receive events, but the modal itself gets an event that you've done
this).
* Fix Supervisor event issues wrt. the window manager feature: if a
focused window exists and Supervisor is running events for the "other"
widgets not in managed windows, and the mouse cursor is over the
rectangle of THE focused window, no widget under the cursor receives
active (hover, click) events. Prevents being able to click "through"
the window and interact with widgets and other windows below.
* Adds Close, Maximize and Minimize buttons to windows. Maximize is
still buggy and Minimize is implementation-defined behavior with no
default event handler configured.
* eg/windows has an example of the Window Manager for SDL2 and
WebAssembly targets.
* Adds Window Manager support to the Supervisor, so that Window widgets
can be dragged by their title bar, clicked to focus, etc.
* Create a ui.Window as normal, but instead of Packing or Placing it
into a parent container as before, you call .Supervise() and give it
your Supervisor. The window registers itself to be managed and drawn
by the Supervisor itself.
* Supervisor manages the focused window order using a doubly linked
list. When a window takes focus it moves to the top of the list.
Widgets in the active window take event priority.
* Extended DragDrop API to support holding a widget pointer in the drag
operation.
* Changed widget event Handle functions to return an error: so that they
could return ErrStopPropagation to prevent events going to more
widgets once handled (for important events).
Some bugs remain around overlapping windows and event propagation.
* Tooltip can be added to any target widget (e.g. Button) and pop up on
mouse over.
* Refactor the event system. Instead of passing a render.Point to all
event handlers, pass an EventData struct which can hold the Point or
the render.Engine.
* Add event types Computed and Present, so a widget can set a handler on
whenever its Computed or Present method is called.
* Button: do not call MoveTo inside of Compute().
* Label: do not call MoveTo inside of Compute().
* MainWindow: add OnLoop callback function support so you can run custom code
each loop and react to the event.State before the UI updates.
* Supervisor: locate widgets using AbsolutePosition() instead of w.Point()
to play nice with Frame and Window packed widgets.
* Widget interface: rename Adopt() to SetParent() which makes more sense for
what the function actually does.
* Window: set itself as the parent of the body Frame so that the Supervisor
can locate widgets anywhere inside a window's frames.
Frame packing fixes:
* Widgets with Expand:true grow their space with ResizeAuto to preserve the
FixedSize() boolean, instead of being hard-resized to fill the Frame.
* Widgets that Fill their space are resized with ResizeAuto too.
Outstanding bugs:
* Labels don't expand (window title bars, etc.)
* Implement Brush Sizes for drawtool.Stroke and add a UI to the tools panel
to control the brush size.
* Brush sizes: 1, 2, 4, 8, 16, 24, 32, 48, 64
* Add the Eraser Tool to editor mode. It uses a default brush size of 16
and a max size of 32 due to some performance issues.
* The Undo/Redo system now remembers the original color of pixels when
you change them, so that Undo will set them back how they were instead
of deleting the pixel entirely. Due to performance issues, this only
happens when your Brush Size is 0 (drawing single-pixel shapes).
* UI: Add an IntVariable option to ui.Label to bind showing the value of
an int reference.
Aforementioned performance issues:
* When we try to remember whole rects of pixels for drawing thick
shapes, it requires a ton of scanning for each step of the shape. Even
de-duplicating pixel checks, tons of extra reads are constantly
checked.
* The Eraser is the only tool that absolutely needs to be able to
remember wiped pixels AND have large brush sizes. The performance
sucks and lags a bit if you erase a lot all at once, but it's a
trade-off for now.
* So pixels aren't remembered when drawing lines in your level with
thick brushes, so the Undo action will simply delete your pixels and not
reset them. Only the Eraser can bring back pixels.
* Toolbar has icon buttons for the Pencil Tool, Line Tool, Rect Tool,
Actor Tool and Link Tool.
* Remove the tab buttons from the top of the Palette window. The palette
tab is now toggled between Swatches and Doodads by the tool selected
on the tool bar, instead of the tab buttons setting the tool.
* Remove the "Link Doodads" button from the Doodad Palette. The Link
Tool has its own dedicated toolbar button with the others.
Since SDL2 is using in-memory bitmaps the same as Canvas engine, the
function names of the render.Engine interface have been cleaned up:
* NewTexture(filename, image) -> StoreTexture(name, image)
Create a new cached texture with a given name.
* NewBitmap(filename) -> LoadTexture(name)
Recall a stored texture with a given name.
* level.Chunk.ToBitmap uses simpler names for the textures instead of
userdir.CacheFilename file-like paths.
* Initial WebAssembly build target for Doodle in the wasm/ folder.
* Add a new render.Engine implementation, lib/render/canvas that uses
the HTML 5 Canvas API instead of SDL2 for the WebAssembly target.
* Ported the basic DrawLine(), DrawBox() etc. functions from SDL2 to
Canvas context2d API.
* Fonts are handled with CSS embedded fonts named after the font
filename and defined in wasm/index.html
* `make wasm` builds the WASM program, and `make wasm-serve` runs a dev
Go server that hosts the WASM file for development. The server also
watches the dev tree for *.go files and rebuilds the WASM binary
automatically on change.
* This build "basically" runs the game. UI and fonts all work and mouse
movements and clicks are detected. No wallpaper support yet or texture
caching (which will crash the game as soon as you click and draw a
pixel in your map!)
* Debug mode: no longer enables the DebugOverlay (F3) by default, but
does now insert the current FPS counter into the window title bar.
* ui.Frame: set a default "mostly transparent" BG color so the frame
background doesn't render as white.
* Add the MenuScene which will house the game's main menus.
* The "New Level" menu is first to be added.
* UI lets you pick Page Type and Wallpaper using radio buttons.
* Page Type: Unbounded, Bounded (default), No Negative Space, Bordered
* Fix bugs in uix.Canvas to fully support all these page types.
* MainWindow is ideal for apps that just want a UI and
don't manage their own SDL windows.
* The example app will grow into a series of demos that
test the UI toolkit to help fix bugs and grow features.
Fixes:
* Move the call to CollidesWithGrid() inside the Canvas instead of
outside in the PlayScene.movePlayer() so it can apply to all Actors
in motion.
* PlayScene.movePlayer() in turn just sets the player's Velocity so the
Canvas.Loop() can move the actor itself.
* When keeping the player inside the level boundaries: previously it was
assuming the player Position was relative to the window, and was
checking the WorldIndexAt and getting wrong results.
* Canvas scrolling (loopFollowActor): check that the actor is getting
close to the screen edge using the Viewport into the world, NOT the
screen-relative coordinates of the Canvas bounding boxes.