Tuesday, July 4, 2017

Abiathar API - Interacting with the UI

The ViewState property on the Abiathar state is very important for showing changes on the screen. It has these members:

  • GetTileImage returns the 16x16 image of the given tile in the given plane.
  • RerenderSelTiles refreshes the selected tile bay.
  • MarkLevelDirty marks the entire given level as in need of a re-render.
  • MarkPlaneDirty marks the given plane of the given level as in need of a re-render.
  • MarkTileDirty takes a level ID, plane, X, Y, new tile ID, and old tile ID, using them to update just that spot if necessary. This is much faster than invalidating an entire plane or level.
  • RerenderViewer updates the level/tileset viewer.
  • SetInfoText sets the tool status text in the lower right.
  • MoveToExtantLevel switches to a level that exists. Call this after deleting a level.
  • ShowingTileset returns the current tileset, or nothing if no tileset is visible at the moment.
  • ShowingLevel returns whether a level is visible.
  • LevelViewOffset returns the X and Y scroll position in the given level. This might throw an exception if the level is not cached.
  • TileViewOffset returns the Y scroll position for the given tileset.
  • VariableTilesetWidth is a historical artifact and always returns false.
  • Config returns the editor configuration. This is probably not useful to any extension.
  • GetPlane returns the plane object for a given level ID and plane name.
  • GetTilePlane does likewise, but for tilesets.
  • ShowTip puts up a "did you know?" in the lower right.
  • SetContextHelpText sets the contextual help text.
  • RefreshMouse creates a mouse movement event at the location of the mouse cursor.
  • SetMouseLocHighlight enables or disables highlighting the tile under the mouse. This is ignored if the user doesn't have that particular Keen:Next nostalgia setting on.
  • GetNumberDisplay formats a number in accordance with the user's numeric base preference for that kind of data.
  • ZipToPoint places the given level position under the mouse cursor. If StoreAsLast is true, the Zip To window will suggest it automatically next time that window is shown.
The UI processing state object (returned by UiProcessingState on the state manager) has these properties:
  • TranslatedClick returns whether the current click event is actually a translation of some other process.
  • DragTranslationActive returns whether the current level or tile tool has some kind of click translation enabled.
Drag translation is activated with the SetDragTranslationMode method on the state manager. You have these options:
  • NoTranslation doesn't do any automatic translation of drags into clicks.
  • ClickOnEveryStep produces a click on every tile the mouse drags over.
  • ClickOnDragEndpoints produces at most two clicks for every drag: one at the start and one at the end.

No comments:

Post a Comment