textmode.js / plugins / TextmodePluginContext
Interface: TextmodePluginContext
Host-provided context passed to plugins when they are installed on a Textmodifier instance.
Properties
| Property | Type | Description |
|---|---|---|
asciiFramebuffer | TextmodeFramebuffer | The framebuffer containing the ASCII representation (from base layer). This framebuffer only has a single attachment. |
canvas | TextmodeCanvasHandle | A stable handle for the canvas used by the Textmodifier instance. |
drawFramebuffer | TextmodeFramebuffer | The framebuffer the user draws to with 3 attachments (from base layer). |
font | | TextmodeFont | TextmodeTileset | The active glyph source used by the Textmodifier instance (from base layer). |
glyphAtlas | TextmodeGlyphAtlas | Backend-neutral glyph atlas used by the Textmodifier instance (from base layer). |
grid | TextmodeGrid | The grid used by the Textmodifier instance (from base layer). |
layerManager | TextmodeLayerManager | The layer manager for accessing and managing all layers. |
Methods
| Method | Description |
|---|---|
| extendLayer | Extend TextmodeLayer instances with a new method. The method will be available on all existing and future layer instances. |
| extendSource | Extend TextmodeSource instances with a new method. The method will be available on image, video, texture, and overlay sources. |
| registerLayerDisposedHook | Register a callback to be invoked when a layer is about to be disposed. |
| registerLayerPostRenderHook | Register a callback to be invoked after each layer's render cycle. This happens after the user draw callback but before the ASCII resolve pass. |
| registerLayerPreRenderHook | Register a callback to be invoked before each layer's render cycle. This happens after the layer's visibility check but before any drawing operations. Useful for rendering content to the layer's framebuffer before user draw callbacks. |
| registerPostDrawHook | Register a callback to be invoked after each draw cycle. Happens outside of the draw framebuffer being bound after the final result is drawn to the screen. |
| registerPostSetupHook | Register a callback to be invoked after the user's setup callback completes. This happens after user code in setup() has finished executing, but before the loading screen finishes and the main render loop begins. Useful for plugins that need to finalize initialization after user setup. |
| registerPreDrawHook | Register a callback to be invoked before each draw cycle. Happens just before any framebuffer |
| registerPreSetupHook | Register a callback to be invoked before the user's setup callback runs. This happens after the Textmodifier and all layers are fully initialized, but before user code in setup() executes. Useful for plugins that need to prepare resources or state before user setup. |
| removeLayerExtension | Remove a method extension from TextmodeLayer. |
| removeSourceExtension | Remove a method extension from TextmodeSource. |