Skip to content

textmode.js / plugins / TextmodePluginContext

Interface: TextmodePluginContext

Host-provided context passed to plugins when they are installed on a Textmodifier instance.

Properties

PropertyTypeDescription
asciiFramebufferTextmodeFramebufferThe framebuffer containing the ASCII representation (from base layer).
This framebuffer only has a single attachment.
canvasTextmodeCanvasHandleA stable handle for the canvas used by the Textmodifier instance.
drawFramebufferTextmodeFramebufferThe framebuffer the user draws to with 3 attachments (from base layer).
font| TextmodeFont | TextmodeTilesetThe active glyph source used by the Textmodifier instance (from base layer).
glyphAtlasTextmodeGlyphAtlasBackend-neutral glyph atlas used by the Textmodifier instance (from base layer).
gridTextmodeGridThe grid used by the Textmodifier instance (from base layer).
layerManagerTextmodeLayerManagerThe layer manager for accessing and managing all layers.

Methods

MethodDescription
extendLayerExtend TextmodeLayer instances with a new method. The method will be available on all existing and future layer instances.
extendSourceExtend TextmodeSource instances with a new method. The method will be available on image, video, texture, and overlay sources.
registerLayerDisposedHookRegister a callback to be invoked when a layer is about to be disposed.
registerLayerPostRenderHookRegister a callback to be invoked after each layer's render cycle. This happens after the user draw callback but before the ASCII resolve pass.
registerLayerPreRenderHookRegister 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.
registerPostDrawHookRegister 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.
registerPostSetupHookRegister 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.
registerPreDrawHookRegister a callback to be invoked before each draw cycle. Happens just before any framebuffer
registerPreSetupHookRegister 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.
removeLayerExtensionRemove a method extension from TextmodeLayer.
removeSourceExtensionRemove a method extension from TextmodeSource.