snake-cli-ts
Version:
Nodejs cli snake game
30 lines (29 loc) • 837 B
TypeScript
/// <reference types="node" />
import { EventEmitter } from 'events';
import MenuOption, { IMenuOptions } from './MenuOptions';
interface ICLIMenuOptions {
title?: string;
options?: IMenuOptions[];
parent?: CLIMenu;
}
export default class CLIMenu extends EventEmitter {
get width(): number;
get height(): number;
title: string;
options: MenuOption[];
parent?: CLIMenu;
maxTextWidth: number;
selectedOption?: MenuOption;
inited: boolean;
constructor(settings?: ICLIMenuOptions);
onResize(): void;
init(): void;
destroy(): void;
calculateTextSize(text: string): {
width: number;
height: number;
};
center(text: string, modifyText?: (text: string) => string, modifyMargin?: number): string;
print(): void;
}
export {};