import type Pointer from "./../../input/pointer.ts"; import Sprite from "./../sprite.js"; /** * This is a basic sprite based button which you can use in your Game UI. * @category UI */ export default class UISpriteElement extends Sprite { /** * if this UISpriteElement should use screen coordinates or local coordinates * (Note: any UISpriteElement elements added to a floating parent container should have their floating property to false) * @see Renderable.floating * @default true */ floating: boolean; /** * object can be clicked or not * @default true */ isClickable: boolean; /** * Tap and hold threshold timeout in ms * @default 250 */ holdThreshold: number; /** * object can be tap and hold * @default false */ isHoldable: boolean; /** * true if the pointer is over the object * @default false */ hover: boolean; holdTimeout: number; released: boolean; /** * @param x - the x coordinate of the UISpriteElement Object * @param y - the y coordinate of the UISpriteElement Object * @param settings - See {@link Sprite} * @param settings.image - the image to use for the sprite * @example * // create a basic GUI Object * class myButton extends UISpriteElement { * constructor(x, y) { * // call the UISpriteElement parent constructor * super(x, y, { * image: "button", * framewidth: 100, * frameheight: 50 * }); * } * * // output something in the console * // when the object is clicked * onClick(event) { * console.log("clicked!"); * // don't propagate the event * return false; * } * }); * * // add the object at pos (10,10) * world.addChild(new myButton(10,10)); */ constructor(x: number, y: number, settings: { image: any; [key: string]: any; }); /** * function callback for the pointerdown event * @ignore */ clicked(event: Pointer): boolean | void; /** * function called when the object is pressed (to be extended) * @param _event - the event object * @returns return false if we need to stop propagating the event */ onClick(_event?: Pointer): boolean; /** * function callback for the pointerEnter event * @ignore */ enter(event: Pointer): void; /** * function called when the pointer is over the object * @param _event - the event object */ onOver(_event?: Pointer): void; /** * function callback for the pointerLeave event * @ignore */ leave(event: Pointer): void; /** * function called when the pointer is leaving the object area * @param _event - the event object */ onOut(_event?: Pointer): void; /** * function callback for the pointerup event * @ignore */ release(event: Pointer): boolean | void; /** * function called when the object is pressed and released (to be extended) * @param _event - the event object * @returns return false if we need to stop propagating the event */ onRelease(_event?: Pointer): boolean; /** * function callback for the tap and hold timer event * @ignore */ hold(): void; /** * function called when the object is pressed and held
* to be extended
*/ onHold(): void; /** * function called when added to the game world or a container * @ignore */ onActivateEvent(): void; /** * function called when removed from the game world or a container * @ignore */ onDeactivateEvent(): void; } //# sourceMappingURL=uispriteelement.d.ts.map