ZepDisplay is the abstract base class that defines the rendering interface for Zep. To integrate Zep with a custom graphics backend, you need to implement a class that inherits from ZepDisplay and override its pure virtual methods.
Overview
The display system provides an abstraction layer between the editor logic and the rendering backend. This allows Zep to work with different UI frameworks like ImGui, Qt, or custom renderers. Header:include/zep/display.h
Core Rendering Methods
These methods must be implemented for any custom display backend:DrawChars
font- The font to use for renderingpos- Screen position in pixelscol- RGBA color (values 0.0 to 1.0)text_begin- Pointer to the first charactertext_end- Optional pointer past the last character (ifnullptr, text is null-terminated)
DrawLine
start- Starting position in pixelsend- Ending position in pixelscolor- RGBA color (defaults to white)width- Line width in pixels
DrawRectFilled
rc- Rectangle boundscol- RGBA color (defaults to white)
SetClipRect
rc- Rectangle to clip to
GetFont
type- One of:UI,Text,Heading1,Heading2,Heading3
Helper Methods
These methods have default implementations but can be overridden:DrawRect
DrawLine four times).
GetCodePointCount
Font Management
SetFont
Bigger / Smaller
Pixel Scale
GetPixelScale / SetPixelScale
Layout Management
LayoutDirty
true if the layout needs to be recalculated.
SetLayoutDirty
Example Implementation
SeeZepDisplayNull in display.h:130 for a minimal reference implementation that discards all drawing operations.
Related Types
ZepTextType
ZepFont
Abstract base class for fonts. Key methods:See Also
- ZepDisplay_ImGui - ImGui implementation
- ZepDisplay_Qt - Qt implementation
