UNPKG

@moderrkowo/jsgl

Version:

Client-side JavaScript library for creating web 2D games. Focusing at objective game.

62 lines (61 loc) 2.4 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.ClickableGameObject = void 0; var DrawableGameObject_1 = require("./DrawableGameObject"); /** * Represents clickable and drawable game object * @group Game Objects */ var ClickableGameObject = /** @class */ (function (_super) { __extends(ClickableGameObject, _super); function ClickableGameObject() { var _this = _super !== null && _super.apply(this, arguments) || this; /** * Defines is this game object has hitbox visible in game. * @property */ _this.showHitbox = false; /** * Defines is this game object ignoring mouse events. * @property */ _this.ignoreRaycast = false; return _this; } /** * Invoked at click on drawed game object * @virtual */ ClickableGameObject.prototype.OnMouseClick = function (event) { }; ClickableGameObject.prototype.OnMouseUp = function (event) { }; ClickableGameObject.prototype.OnMouseDown = function (event) { }; /** * Invoked at hover start on drawed game object * @returns is handled? * @virtual */ ClickableGameObject.prototype.OnMouseHoverStart = function (event) { }; /** * Invoked at hover end on drawed game object * @returns is handled? * @virtual */ ClickableGameObject.prototype.OnMouseHoverEnd = function (event) { }; return ClickableGameObject; }(DrawableGameObject_1.DrawableGameObject)); exports.ClickableGameObject = ClickableGameObject;