import { RoundRect } from "../../geometries/roundrect.ts";
import type { Bounds } from "../../physics/bounds.ts";
import type Renderer from "../../video/renderer.js";
import BitmapText from "../text/bitmaptext.js";
import UIBaseElement from "./uibaseelement.ts";
interface UITextButtonSettings {
font?: string;
size?: number;
text?: string;
bindKey?: string | number;
hoverOffColor?: string;
hoverOnColor?: string;
borderStrokeColor?: string;
fillStyle?: string;
textAlign?: string;
textBaseline?: string;
borderWidth?: number;
borderHeight?: number;
[key: string]: any;
}
/**
* This is a basic base text button which you can use in your Game UI.
* @category UI
*/
export default class UITextButton extends UIBaseElement {
/**
* The key to bind the action to
*/
bindKey: string | number;
/**
* The css value of a color to be used if the pointer is not hovering over the button
*/
hoverOffColor: string;
/**
* The css value of a color to be used if the pointer hovers over the button
*/
hoverOnColor: string;
/**
* The css value of a color to be used to draw the border
*/
borderStrokeColor: string;
/**
* Set the default text alignment (or justification),
* possible values are "left", "right", and "center".
* @default "center"
*/
textAlign: string;
/**
* Set the text baseline (e.g. the Y-coordinate for the draw operation),
* possible values are "top", "hanging", "middle", "alphabetic", "ideographic", "bottom"
* @default "middle"
*/
textBaseline: string;
/**
* the bitmapText used by the UITextButton class
*/
bitmapText: BitmapText;
/**
* the measured text dimensions
*/
dimensions: Bounds;
/**
* the round rect border
*/
border: RoundRect;
/**
* A Bitmap Text Button with an outlined background border, filled with background color.
* It uses a RoundRect as background and changes the background color on hovering over.
* The background will be drawn with 0.5 opacity, so that the background of the button is
* slightly shining through.
* @param x - x pos of the button
* @param y - y pos of the button
* @param settings - settings object
* @example
* // Create a new Button
* class PlayButton extends UITextButton {
* constructor(x,y) {
* super(x,y, {
* font: 'my-font',
* text: 'Play',
* // if you omit the next two, size is calculated by the size of the text
* borderWidth: 200,
* borderHeight: 20,
* hoverOffColor: '#00aa0080',
* hoverOnColor: '#00ff00ff'
* });
* }
*
* onClick(){
* state.change(state.PLAY);
* }
* }
*
* world.addChild(new PlayButton(15,200));
*/
constructor(x: number, y: number, settings: UITextButtonSettings);
draw(renderer: Renderer): void;
}
export {};
//# sourceMappingURL=uitextbutton.d.ts.map