Commit Graph

7 Commits (4ba563d48d6f1f3ca20d1855a0567fc08343ebb9)

Author SHA1 Message Date
Noah 4ba563d48d Supervisor, Frame Pack and Misc Fixes
* 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.)
2019-12-29 00:00:03 -08:00
Noah 3e73a6effb Change types int32 -> int per upstream render library 2019-12-27 19:12:00 -08:00
Noah 2f5b498ca1 Add README, LICENSE and Examples 2019-12-27 16:06:24 -08:00
Noah e391e703bf Cut lib/render into its own package, change all imports 2019-12-22 18:21:58 -08:00
Noah 5450f40b3c render: Refactor Events System to Make Module Standalone
* Refactor the events used in lib/render/sdl to be more general-purpose
  to make librender a stand-alone library separate from Doodle.
2019-12-22 14:11:01 -08:00
Noah 0efc577fa7 Initial WebAssembly Build Target
* 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!)
2019-06-26 18:40:40 -07:00
Noah aceb7e7a7e UI: Add MainWindow Widget and start an example app
* 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.
2019-06-08 17:03:59 -07:00