51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
/**
|
|
* Copyright (c) 2026 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
/** VN-style typewriter textbox singleton. */
|
|
interface UITextboxNamespace {
|
|
/** `true` when the typewriter has fully revealed the current page. */
|
|
readonly isPageComplete: boolean;
|
|
/** `true` when at least one more page follows the current one. */
|
|
readonly hasNextPage: boolean;
|
|
/** Zero-based index of the current page. */
|
|
readonly currentPage: number;
|
|
/** Total number of pages for the current text. */
|
|
readonly pageCount: number;
|
|
|
|
/**
|
|
* Sets the textbox content and rebuilds the word-wrap layout.
|
|
* Resets to page 0 and scroll 0.
|
|
* @param text - Text to display (max 1024 chars).
|
|
*/
|
|
setText(text: string): void;
|
|
|
|
/**
|
|
* Advances to the next page; no-op on the last page.
|
|
*/
|
|
nextPage(): void;
|
|
|
|
/**
|
|
* Advances the typewriter scroll by one tick.
|
|
* Call once per frame before `draw()`.
|
|
*/
|
|
update(): void;
|
|
|
|
/**
|
|
* Draws the frame and currently visible text.
|
|
* Call once per frame after `update()`.
|
|
*/
|
|
draw(): void;
|
|
|
|
/**
|
|
* Sets the input action that auto-advances the textbox when held.
|
|
* @param action - An `INPUT_ACTION_*` constant.
|
|
*/
|
|
setAdvanceAction(action: InputAction): void;
|
|
}
|
|
|
|
declare var UITextbox: UITextboxNamespace;
|