Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | 1x 1x 1x 1x 1x 1x 1x 1x 18x 18x 18x 5x 5x 5x 23x 21x 2x 2x 2x 1x 1x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 4x 1x 3x 2x 2x 2x 1x 1x 1x 1x 2x 1x | "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EngineCanvas = void 0; const surfaceSettings_1 = require("./controller/surface/surfaceSettings"); const engineCore_1 = require("./engineCore"); const factoryContext_1 = require("./factories/factoryContext"); const factoryInput_1 = require("./factories/factoryInput"); const factorySurface_1 = require("./factories/factorySurface"); const vector2_1 = require("./models/vector2"); class EngineCanvas extends HTMLElement { static getCanvas(canvasId, window) { this.connectCanvas(window); const document = this._window.document; return document.getElementById(canvasId); } static getEngine(canvasId, window) { this.connectCanvas(window); const engineCanvas = EngineCanvas.getCanvas(canvasId, window); return engineCanvas === null || engineCanvas === void 0 ? void 0 : engineCanvas._engineCore; } static connectCanvas(window) { if (!window || this._window === window) return; this._window = window; const customElements = window.customElements; customElements.define("engine-canvas", this); } connectedCallback() { const window = EngineCanvas._window; this.initializeEngine(window); } disconnectedCallback() { var _a; (_a = this._engineCore) === null || _a === void 0 ? void 0 : _a.destroy(); this.replaceChildren(); } initializeEngine(window) { const targetFrameRate = this.getAttributeValue("target-frame-rate", 60); const targetFrameLimit = this.getAttributeValue("target-frame-limit", 0); const targetResolution = this.getAttributeValue("target-resolution", new vector2_1.Vector2(1920, 1080)); const maxResolution = this.getAttributeValue("max-resolution", new vector2_1.Vector2()); const inputFactory = new factoryInput_1.FactoryInput(this); const contextFactory = new factoryContext_1.FactoryContext(this, window.document); const surfaceSettings = new surfaceSettings_1.SurfaceSettings(targetFrameRate, targetFrameLimit, targetResolution, maxResolution); const surfaceFactory = new factorySurface_1.FactorySurface(surfaceSettings, window); this._engineCore = new engineCore_1.EngineCore(surfaceSettings, surfaceFactory, contextFactory, inputFactory, window); } getAttributeValue(attributeName, defaultValue) { let attributeValue = defaultValue; const attribute = this.getAttribute(attributeName); if (!attribute) { return attributeValue; } if (defaultValue instanceof vector2_1.Vector2) { const resolutionLowerCase = attribute.toLowerCase(); const resolutionArray = resolutionLowerCase.split("x"); if (resolutionArray.length > 1) { const resolution = new vector2_1.Vector2(); resolution.x = parseInt(resolutionArray[0]); resolution.y = parseInt(resolutionArray[1]); return resolution; } } return parseInt(attribute); } } exports.EngineCanvas = EngineCanvas; |