Friday, July 7, 2017

Abiathar API - Render planes

The image of a level or tileset in Abiathar is composed of planes stacked on top of each other. Though planes are not removed from the list of planes once added, they choose to render or not based on the user's instructions. Classic planes keep an image, which Abiathar's renderer draws where appropriate. Ephemeral planes draw directly on a graphics context. Planes implement either ILevelRenderPlane or ITilesetRenderPlane as appropriate. Both those interfaces are inherited from IRenderPlane, which has these members:

  • RenderNow gets whether the plane should be asked to show itself currently.
  • Image gets the image to render. This is not used for ephemeral planes.
  • ConsiderOffset gets whether Abiathar needs to position the plane according to the scroll position. This is not used for ephemeral planes.
  • PlaneName is the ID of the plane. By convention, IDs take the form of the extension name, a colon, and a plane title.
  • NeedsUpdate gets whether the plane should be asked to completely re-render itself at the next draw. Ephemeral planes should always return false.
  • HasTileinfo returns whether the plane displays tileinfo for the given simple plane (0 or 1).
  • SetStateAccessor is called so Abiathar can give the plane a state manager.
  • Render instructs the plane to prepare its Image. This is not used for ephemeral planes.
  • MarkDirty instructs the plane to mark itself as in need of a full update. This can be ignored by ephemeral planes.
  • IsEphemeral gets whether the plane uses ephemeral rendering.
  • RenderEphemeral instructs the plane to draw its contents on the given graphics with the given zoom level and offset. This is only used for ephemeral planes.
Level planes also have these members:
  • LevelPlane gets the simple plane (0 to 2) that the plane draws, or some other value if it does not correspond to any particular level plane.
  • SetRenderLevel is called to provide the plane with the level object it should render.
  • UpdateTile is called when a single tile is marked dirty. Return whether any changes were made to the image.
Tileset planes have these members in addition to the common plane members:
  • TilePlane is a historical artifact and is not used.
  • SetRenderPalette provides the plane with its tileset object.
  • UpdateSelectedTile is called when the selected tile for a plane changes. It provides the simple plane ID and the new tile ID.
  • TileViewSettingsChanged is not called by Abiathar.
To register a plane, add it to the Planes list of an AbiatharLevelViewStateInitializeEvent (for level planes) or an AbiatharTileViewStateInitializeEvent (for tileset planes) in the event bus.

No comments:

Post a Comment