textui/display.ts

32 lines
827 B
TypeScript
Raw Normal View History

2021-05-13 22:04:47 +00:00
import { BufferLocation, BufferSize, Char, Color } from "./base.ts";
2021-05-11 21:20:33 +00:00
/**
* Display protocol, to allow the UI to draw things on "screen"
*/
export interface Display {
2021-05-13 22:04:47 +00:00
/**
* Get the displayable grid size
*/
getSize(): Promise<BufferSize>;
2021-05-11 21:20:33 +00:00
/**
* Setup the palette for color display
*
* If the display supports the whole RGB range, it may return the array as-is.
* If the display only supports a limited palette, it may return only supported colors.
*
* From this call forward, colors will be received by numbered index in the returned array.
*/
setupPalette(colors: readonly Color[]): Promise<readonly Color[]>;
/**
* Clear the whole screen
*/
clear(): Promise<void>;
2021-05-13 22:04:47 +00:00
/**
* Draw a single character on screen
*/
setChar(at: BufferLocation, char: Char): Promise<void>;
2021-05-11 21:20:33 +00:00
}