Skip to content

components & core API upgrades

Compare
Choose a tag to compare
@dustmop dustmop released this 28 Nov 18:02
· 85 commits to main since this release

This release aims to solidify the Core API of raster.js, by better defining semantics of how rendering works, and rewriting many of the Components used by the renderer. In addition there are bug fixes for specific runtime environments and a couple of new features.

Features:

  • Multiple layers work on webgl display
  • ImageLoader can load images using an alias
  • Events: click with region, and sendMessage
  • Polygon objects can be constructed with a center point

Core API improvements:

  • run method only, no more show. If the drawFunc given to run is null, the display will render once, then stop the main loop
    • runFrame can be called to re-render. This is an efficient way to only render when changes occur.
  • paste method, renamed from drawImage. This method can accept selections, tiles, or any Plane, not just Images
  • xform method
    • can flip a Plane horizontally or vertically
  • fillFrame: traverse and buffer options
  • setColor and fillColor must get numbers
  • selections can have names

Environments:

  • Node.js
    • SDL is optional, the default http display works without it, as does --save
    • optional instrumentation of SDL loop
    • --time-tick command-line option
    • --save on command-line will composite layers
  • Web
    • inspector will keep re-rendering components
    • fix race condition caused by document.readyState bug

Components:

  • Palette
    • removed the colorMap component, just use the palette's rgbmap
    • added the concept of entries, which mirror how the old palette used to work
    • easier cycling using palette.cycle and look and upon
  • Tileset
    • addFrom method, returns PatternTable
    • fill, put, serialize, fillPattern methods
    • serialize & deserialize
  • Sprites
    • render sprites with a lower index on top
  • Display
    • better API for custom displays
  • Colorspace
    • renamed from attributes
    • fill, put, fillPattern methods