canvasengine 2.0.0-beta.37 → 2.0.0-beta.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DebugRenderer-CTWPthRt.js → DebugRenderer-Rrw9FlTd.js} +2 -2
- package/dist/{DebugRenderer-CTWPthRt.js.map → DebugRenderer-Rrw9FlTd.js.map} +1 -1
- package/dist/components/Button.d.ts +50 -3
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Canvas.d.ts.map +1 -1
- package/dist/components/Joystick.d.ts +36 -0
- package/dist/components/Joystick.d.ts.map +1 -0
- package/dist/components/Sprite.d.ts +2 -0
- package/dist/components/Sprite.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/types/Spritesheet.d.ts +0 -118
- package/dist/components/types/Spritesheet.d.ts.map +1 -1
- package/dist/directives/Controls.d.ts +16 -7
- package/dist/directives/Controls.d.ts.map +1 -1
- package/dist/directives/GamepadControls.d.ts +3 -1
- package/dist/directives/GamepadControls.d.ts.map +1 -1
- package/dist/directives/JoystickControls.d.ts +172 -0
- package/dist/directives/JoystickControls.d.ts.map +1 -0
- package/dist/directives/index.d.ts +1 -0
- package/dist/directives/index.d.ts.map +1 -1
- package/dist/engine/reactive.d.ts.map +1 -1
- package/dist/engine/signal.d.ts.map +1 -1
- package/dist/{index-BqwprEPH.js → index-BQ99FClW.js} +6057 -5433
- package/dist/index-BQ99FClW.js.map +1 -0
- package/dist/index.global.js +7 -7
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +59 -57
- package/dist/utils/GlobalAssetLoader.d.ts +141 -0
- package/dist/utils/GlobalAssetLoader.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/Button.ts +168 -41
- package/src/components/Canvas.ts +3 -0
- package/src/components/Joystick.ts +361 -0
- package/src/components/Sprite.ts +82 -16
- package/src/components/index.ts +2 -1
- package/src/components/types/Spritesheet.ts +0 -118
- package/src/directives/Controls.ts +42 -8
- package/src/directives/GamepadControls.ts +40 -18
- package/src/directives/JoystickControls.ts +396 -0
- package/src/directives/index.ts +1 -0
- package/src/engine/reactive.ts +362 -242
- package/src/engine/signal.ts +8 -2
- package/src/utils/GlobalAssetLoader.ts +257 -0
- package/dist/index-BqwprEPH.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bounds as F, Rectangle as C, Container as M, Graphics as x, BigPool as b } from "pixi.js";
|
|
2
|
-
import { F as _, E as p } from "./index-
|
|
2
|
+
import { F as _, E as p } from "./index-BQ99FClW.js";
|
|
3
3
|
var l = /* @__PURE__ */ ((e) => (e.Margin = "margin", e.Padding = "padding", e.Border = "border", e.Flex = "flex", e.Content = "content", e))(l || {});
|
|
4
4
|
function w(e, t) {
|
|
5
5
|
const r = `getComputed${t.charAt(0).toUpperCase() + t.slice(1)}`;
|
|
@@ -169,4 +169,4 @@ class y {
|
|
|
169
169
|
export {
|
|
170
170
|
y as DebugRenderer
|
|
171
171
|
};
|
|
172
|
-
//# sourceMappingURL=DebugRenderer-
|
|
172
|
+
//# sourceMappingURL=DebugRenderer-Rrw9FlTd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DebugRenderer-CTWPthRt.js","sources":["../../../node_modules/.pnpm/@pixi+layout@3.0.2_@types+react@19.1.3_pixi.js@8.9.2_react@19.1.0_yoga-layout@3.2.1/node_modules/@pixi/layout/dist/core/debug/calculateDebugRegions.mjs","../../../node_modules/.pnpm/@pixi+layout@3.0.2_@types+react@19.1.3_pixi.js@8.9.2_react@19.1.0_yoga-layout@3.2.1/node_modules/@pixi/layout/dist/core/debug/DebugNode.mjs","../../../node_modules/.pnpm/@pixi+layout@3.0.2_@types+react@19.1.3_pixi.js@8.9.2_react@19.1.0_yoga-layout@3.2.1/node_modules/@pixi/layout/dist/core/debug/DebugRenderer.mjs"],"sourcesContent":["import { Bounds, Rectangle } from \"pixi.js\";\nimport { Edge, FlexDirection } from \"yoga-layout/load\";\nvar DebugRegionType = /* @__PURE__ */ ((DebugRegionType2) => {\n DebugRegionType2[\"Margin\"] = \"margin\";\n DebugRegionType2[\"Padding\"] = \"padding\";\n DebugRegionType2[\"Border\"] = \"border\";\n DebugRegionType2[\"Flex\"] = \"flex\";\n DebugRegionType2[\"Content\"] = \"content\";\n return DebugRegionType2;\n})(DebugRegionType || {});\nfunction getEdgeValues(layout, type) {\n const method = `getComputed${type.charAt(0).toUpperCase() + type.slice(1)}`;\n return {\n top: layout.yoga[method](Edge.Top),\n right: layout.yoga[method](Edge.Right),\n bottom: layout.yoga[method](Edge.Bottom),\n left: layout.yoga[method](Edge.Left)\n };\n}\nfunction calculateRegions(layout, regions) {\n const { width, height } = layout.computedLayout;\n const margin = getEdgeValues(layout, \"margin\");\n const border = getEdgeValues(layout, \"border\");\n const padding = getEdgeValues(layout, \"padding\");\n const marginRegion = regions.get(\n \"margin\"\n /* Margin */\n );\n marginRegion.outer.x = -margin.left;\n marginRegion.outer.y = -margin.top;\n marginRegion.outer.width = width + margin.left + margin.right;\n marginRegion.outer.height = height + margin.top + margin.bottom;\n marginRegion.inner.x = 0;\n marginRegion.inner.y = 0;\n marginRegion.inner.width = width;\n marginRegion.inner.height = height;\n const borderRegion = regions.get(\n \"border\"\n /* Border */\n );\n borderRegion.outer.x = 0;\n borderRegion.outer.y = 0;\n borderRegion.outer.width = width;\n borderRegion.outer.height = height;\n borderRegion.inner.x = border.left;\n borderRegion.inner.y = border.top;\n borderRegion.inner.width = width - border.left - border.right;\n borderRegion.inner.height = height - border.top - border.bottom;\n const paddingRegion = regions.get(\n \"padding\"\n /* Padding */\n );\n paddingRegion.outer.copyFrom(borderRegion.inner);\n paddingRegion.inner.x = padding.left + border.left;\n paddingRegion.inner.y = padding.top + border.top;\n paddingRegion.inner.width = width - padding.left - padding.right - border.left - border.right;\n paddingRegion.inner.height = height - padding.top - padding.bottom - border.top - border.bottom;\n calculateFlexRegion(layout, regions);\n}\nfunction calculateFlexRegion(layout, regions) {\n var _a;\n const flexRegion = regions.get(\n \"flex\"\n /* Flex */\n );\n const paddingRegion = regions.get(\n \"padding\"\n /* Padding */\n );\n flexRegion.outer.copyFrom(paddingRegion.inner);\n const bounds = new Bounds();\n const children = layout.yoga.getChildCount();\n for (let i = 0; i < children; i++) {\n const child = layout.yoga.getChild(i);\n const computedBounds = child.getComputedLayout();\n bounds.addRect(\n new Rectangle(computedBounds.left, computedBounds.top, computedBounds.width, computedBounds.height)\n );\n }\n const flexDir = layout.yoga.getFlexDirection();\n if (flexDir === FlexDirection.Column || flexDir === FlexDirection.ColumnReverse) {\n bounds.width = flexRegion.outer.width;\n bounds.x = flexRegion.outer.x;\n } else {\n bounds.height = flexRegion.outer.height;\n bounds.y = flexRegion.outer.y;\n }\n (_a = flexRegion.inner) == null ? void 0 : _a.copyFrom(bounds.rectangle);\n regions.get(\n \"content\"\n /* Content */\n ).outer.copyFrom(bounds.rectangle);\n}\nexport {\n DebugRegionType,\n calculateRegions\n};\n//# sourceMappingURL=calculateDebugRegions.mjs.map\n","var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport { Container, Graphics as Graphics$1 } from \"pixi.js\";\nimport { DebugRegionType } from \"./calculateDebugRegions.mjs\";\nfunction lerpColor(start, end, t) {\n const r = Math.round(start[0] + (end[0] - start[0]) * t);\n const g = Math.round(start[1] + (end[1] - start[1]) * t);\n const b = Math.round(start[2] + (end[2] - start[2]) * t);\n return `rgb(${r},${g},${b})`;\n}\nclass DebugNode extends Container {\n constructor() {\n super();\n /** Graphics objects for each region type */\n __publicField(this, \"graphics\");\n __publicField(this, \"heatGraphics\");\n this.graphics = /* @__PURE__ */ new Map();\n Object.values(DebugRegionType).forEach((type) => {\n const graphics = new Graphics$1();\n this.graphics.set(type, graphics);\n this.addChild(graphics);\n });\n this.heatGraphics = new Graphics$1();\n this.addChild(this.heatGraphics);\n }\n /**\n * Initialize the debug object with region data\n */\n init(regions) {\n const { target, alpha, heat } = regions;\n if (!regions.heatOnly) {\n Object.entries(regions).forEach(([type, region]) => {\n if (type === \"target\" || type === \"alpha\" || type === \"heat\" || type === \"heatOnly\") return;\n region = region;\n const graphics = this.graphics.get(type);\n if (!graphics || !region.draw) return;\n if (region.inner) {\n this.drawCutBox(graphics, region.outer, region.inner, region.color, alpha);\n } else {\n const { x, y, width, height } = region.outer;\n graphics.rect(x, y, width, Math.max(height, 1));\n graphics.fill({ color: region.color, alpha });\n }\n });\n }\n const { invalidationCount, draw } = heat;\n if (invalidationCount > 0 && draw) {\n const MAX_INVALIDATE_COUNT = 20;\n const normalizedAlpha = Math.min(invalidationCount / MAX_INVALIDATE_COUNT, 1);\n const marginRegion = regions[DebugRegionType.Margin];\n const startColor = [255, 255, 0];\n const endColor = [255, 0, 0];\n const color = lerpColor(startColor, endColor, normalizedAlpha);\n this.heatGraphics.rect(\n marginRegion.outer.x,\n marginRegion.outer.y,\n marginRegion.outer.width,\n marginRegion.outer.height\n );\n this.heatGraphics.fill({ color, alpha: Math.min(0.3, normalizedAlpha) });\n this.heatGraphics.stroke({ color, alpha: Math.max(0.3, normalizedAlpha), pixelLine: true });\n }\n this.position.set(target.x, target.y);\n }\n /**\n * Reset the debug object's state\n */\n reset() {\n this.graphics.forEach((graphics) => graphics.clear());\n this.heatGraphics.clear();\n this.removeFromParent();\n }\n /**\n * Draw a box with a cut-out center\n */\n drawCutBox(graphics, outer, inner, color, alpha) {\n const { x, y, width, height } = outer;\n const { x: innerX, y: innerY, width: innerWidth, height: innerHeight } = inner;\n graphics.rect(x, y, width, height);\n graphics.fill({ color, alpha });\n graphics.rect(innerX, innerY, innerWidth, innerHeight);\n graphics.cut();\n }\n}\nexport {\n DebugNode\n};\n//# sourceMappingURL=DebugNode.mjs.map\n","var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport { Container, Rectangle, BigPool } from \"pixi.js\";\nimport { DebugRegionType, calculateRegions } from \"./calculateDebugRegions.mjs\";\nimport { DebugNode } from \"./DebugNode.mjs\";\nclass DebugRenderer {\n constructor() {\n /** Container for all debug visuals */\n __publicField(this, \"holder\", new Container());\n /** Region data for each debug type */\n __publicField(this, \"regions\", /* @__PURE__ */ new Map());\n /** Color configuration for each region type */\n __publicField(this, \"colors\", {\n [DebugRegionType.Margin]: \"#B68655\",\n [DebugRegionType.Padding]: \"#BAC57F\",\n [DebugRegionType.Border]: \"#E7C583\",\n [DebugRegionType.Content]: \"#89B1BE\",\n [DebugRegionType.Flex]: \"#6E28D9\"\n });\n /** Global alpha value for all regions */\n __publicField(this, \"alpha\", 0.75);\n Object.values(DebugRegionType).forEach((type) => {\n this.regions.set(type, {\n outer: new Rectangle(),\n inner: new Rectangle()\n });\n });\n this.holder.__devtoolIgnore = true;\n this.holder.__devtoolIgnoreChildren = true;\n this.holder.eventMode = \"none\";\n this.holder.interactiveChildren = false;\n }\n /**\n * Clean up previous render state\n */\n reset() {\n for (let i = this.holder.children.length - 1; i >= 0; i--) {\n const child = this.holder.children[i];\n BigPool.return(child);\n }\n }\n /**\n * Render debug visuals for the given layout\n */\n render(layout) {\n calculateRegions(layout, this.regions);\n const regionData = Object.values(DebugRegionType).reduce(\n (acc, type) => {\n const region = this.regions.get(type);\n if (!region) return acc;\n const drawString = `debugDraw${type.charAt(0).toUpperCase()}${type.slice(1)}`;\n acc[type] = {\n ...region,\n color: this.colors[type],\n draw: layout._styles.custom[drawString] ?? true\n };\n return acc;\n },\n {}\n );\n const { left, top } = layout.computedLayout;\n const pos = layout.target.getGlobalPosition();\n const debugObject = BigPool.get(DebugNode, {\n ...regionData,\n target: { x: pos.x + left, y: pos.y + top },\n alpha: this.alpha,\n heat: {\n invalidationCount: layout._modificationCount,\n draw: layout._styles.custom.debugHeat !== false\n },\n heatOnly: !layout._styles.custom.debug\n });\n this.holder.addChildAt(debugObject, 0);\n }\n /**\n * Clean up the debug renderer\n */\n destroy() {\n this.reset();\n this.holder.destroy();\n this.regions.clear();\n }\n}\nexport {\n DebugRenderer\n};\n//# sourceMappingURL=DebugRenderer.mjs.map\n"],"names":["DebugRegionType","DebugRegionType2","getEdgeValues","layout","type","method","Edge","calculateRegions","regions","width","height","margin","border","padding","marginRegion","borderRegion","paddingRegion","calculateFlexRegion","_a","flexRegion","bounds","Bounds","children","i","computedBounds","Rectangle","flexDir","FlexDirection","__defProp","__defNormalProp","obj","key","value","__publicField","lerpColor","start","end","t","r","g","b","DebugNode","Container","graphics","Graphics$1","target","alpha","heat","region","x","y","invalidationCount","draw","normalizedAlpha","color","outer","inner","innerX","innerY","innerWidth","innerHeight","DebugRenderer","child","BigPool","regionData","acc","drawString","left","top","pos","debugObject"],"mappings":";;AAEA,IAAIA,IAAmC,kBAACC,OACtCA,EAAiB,SAAY,UAC7BA,EAAiB,UAAa,WAC9BA,EAAiB,SAAY,UAC7BA,EAAiB,OAAU,QAC3BA,EAAiB,UAAa,WACvBA,IACND,KAAmB,CAAA,CAAE;AACxB,SAASE,EAAcC,GAAQC,GAAM;AACnC,QAAMC,IAAS,cAAcD,EAAK,OAAO,CAAC,EAAE,YAAa,IAAGA,EAAK,MAAM,CAAC,CAAC;AACzE,SAAO;AAAA,IACL,KAAKD,EAAO,KAAKE,CAAM,EAAEC,EAAK,GAAG;AAAA,IACjC,OAAOH,EAAO,KAAKE,CAAM,EAAEC,EAAK,KAAK;AAAA,IACrC,QAAQH,EAAO,KAAKE,CAAM,EAAEC,EAAK,MAAM;AAAA,IACvC,MAAMH,EAAO,KAAKE,CAAM,EAAEC,EAAK,IAAI;AAAA,EACpC;AACH;AACA,SAASC,EAAiBJ,GAAQK,GAA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AAK,MAAO,GACZ,KAAK,OAAO,QAAS,GACrB,KAAK,QAAQ,MAAO;AAAA,EACxB;AACA;","x_google_ignoreList":[0,1,2]}
|
|
1
|
+
{"version":3,"file":"DebugRenderer-Rrw9FlTd.js","sources":["../../../node_modules/.pnpm/@pixi+layout@3.0.2_@types+react@19.1.3_pixi.js@8.9.2_react@19.1.0_yoga-layout@3.2.1/node_modules/@pixi/layout/dist/core/debug/calculateDebugRegions.mjs","../../../node_modules/.pnpm/@pixi+layout@3.0.2_@types+react@19.1.3_pixi.js@8.9.2_react@19.1.0_yoga-layout@3.2.1/node_modules/@pixi/layout/dist/core/debug/DebugNode.mjs","../../../node_modules/.pnpm/@pixi+layout@3.0.2_@types+react@19.1.3_pixi.js@8.9.2_react@19.1.0_yoga-layout@3.2.1/node_modules/@pixi/layout/dist/core/debug/DebugRenderer.mjs"],"sourcesContent":["import { Bounds, Rectangle } from \"pixi.js\";\nimport { Edge, FlexDirection } from \"yoga-layout/load\";\nvar DebugRegionType = /* @__PURE__ */ ((DebugRegionType2) => {\n DebugRegionType2[\"Margin\"] = \"margin\";\n DebugRegionType2[\"Padding\"] = \"padding\";\n DebugRegionType2[\"Border\"] = \"border\";\n DebugRegionType2[\"Flex\"] = \"flex\";\n DebugRegionType2[\"Content\"] = \"content\";\n return DebugRegionType2;\n})(DebugRegionType || {});\nfunction getEdgeValues(layout, type) {\n const method = `getComputed${type.charAt(0).toUpperCase() + type.slice(1)}`;\n return {\n top: layout.yoga[method](Edge.Top),\n right: layout.yoga[method](Edge.Right),\n bottom: layout.yoga[method](Edge.Bottom),\n left: layout.yoga[method](Edge.Left)\n };\n}\nfunction calculateRegions(layout, regions) {\n const { width, height } = layout.computedLayout;\n const margin = getEdgeValues(layout, \"margin\");\n const border = getEdgeValues(layout, \"border\");\n const padding = getEdgeValues(layout, \"padding\");\n const marginRegion = regions.get(\n \"margin\"\n /* Margin */\n );\n marginRegion.outer.x = -margin.left;\n marginRegion.outer.y = -margin.top;\n marginRegion.outer.width = width + margin.left + margin.right;\n marginRegion.outer.height = height + margin.top + margin.bottom;\n marginRegion.inner.x = 0;\n marginRegion.inner.y = 0;\n marginRegion.inner.width = width;\n marginRegion.inner.height = height;\n const borderRegion = regions.get(\n \"border\"\n /* Border */\n );\n borderRegion.outer.x = 0;\n borderRegion.outer.y = 0;\n borderRegion.outer.width = width;\n borderRegion.outer.height = height;\n borderRegion.inner.x = border.left;\n borderRegion.inner.y = border.top;\n borderRegion.inner.width = width - border.left - border.right;\n borderRegion.inner.height = height - border.top - border.bottom;\n const paddingRegion = regions.get(\n \"padding\"\n /* Padding */\n );\n paddingRegion.outer.copyFrom(borderRegion.inner);\n paddingRegion.inner.x = padding.left + border.left;\n paddingRegion.inner.y = padding.top + border.top;\n paddingRegion.inner.width = width - padding.left - padding.right - border.left - border.right;\n paddingRegion.inner.height = height - padding.top - padding.bottom - border.top - border.bottom;\n calculateFlexRegion(layout, regions);\n}\nfunction calculateFlexRegion(layout, regions) {\n var _a;\n const flexRegion = regions.get(\n \"flex\"\n /* Flex */\n );\n const paddingRegion = regions.get(\n \"padding\"\n /* Padding */\n );\n flexRegion.outer.copyFrom(paddingRegion.inner);\n const bounds = new Bounds();\n const children = layout.yoga.getChildCount();\n for (let i = 0; i < children; i++) {\n const child = layout.yoga.getChild(i);\n const computedBounds = child.getComputedLayout();\n bounds.addRect(\n new Rectangle(computedBounds.left, computedBounds.top, computedBounds.width, computedBounds.height)\n );\n }\n const flexDir = layout.yoga.getFlexDirection();\n if (flexDir === FlexDirection.Column || flexDir === FlexDirection.ColumnReverse) {\n bounds.width = flexRegion.outer.width;\n bounds.x = flexRegion.outer.x;\n } else {\n bounds.height = flexRegion.outer.height;\n bounds.y = flexRegion.outer.y;\n }\n (_a = flexRegion.inner) == null ? void 0 : _a.copyFrom(bounds.rectangle);\n regions.get(\n \"content\"\n /* Content */\n ).outer.copyFrom(bounds.rectangle);\n}\nexport {\n DebugRegionType,\n calculateRegions\n};\n//# sourceMappingURL=calculateDebugRegions.mjs.map\n","var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport { Container, Graphics as Graphics$1 } from \"pixi.js\";\nimport { DebugRegionType } from \"./calculateDebugRegions.mjs\";\nfunction lerpColor(start, end, t) {\n const r = Math.round(start[0] + (end[0] - start[0]) * t);\n const g = Math.round(start[1] + (end[1] - start[1]) * t);\n const b = Math.round(start[2] + (end[2] - start[2]) * t);\n return `rgb(${r},${g},${b})`;\n}\nclass DebugNode extends Container {\n constructor() {\n super();\n /** Graphics objects for each region type */\n __publicField(this, \"graphics\");\n __publicField(this, \"heatGraphics\");\n this.graphics = /* @__PURE__ */ new Map();\n Object.values(DebugRegionType).forEach((type) => {\n const graphics = new Graphics$1();\n this.graphics.set(type, graphics);\n this.addChild(graphics);\n });\n this.heatGraphics = new Graphics$1();\n this.addChild(this.heatGraphics);\n }\n /**\n * Initialize the debug object with region data\n */\n init(regions) {\n const { target, alpha, heat } = regions;\n if (!regions.heatOnly) {\n Object.entries(regions).forEach(([type, region]) => {\n if (type === \"target\" || type === \"alpha\" || type === \"heat\" || type === \"heatOnly\") return;\n region = region;\n const graphics = this.graphics.get(type);\n if (!graphics || !region.draw) return;\n if (region.inner) {\n this.drawCutBox(graphics, region.outer, region.inner, region.color, alpha);\n } else {\n const { x, y, width, height } = region.outer;\n graphics.rect(x, y, width, Math.max(height, 1));\n graphics.fill({ color: region.color, alpha });\n }\n });\n }\n const { invalidationCount, draw } = heat;\n if (invalidationCount > 0 && draw) {\n const MAX_INVALIDATE_COUNT = 20;\n const normalizedAlpha = Math.min(invalidationCount / MAX_INVALIDATE_COUNT, 1);\n const marginRegion = regions[DebugRegionType.Margin];\n const startColor = [255, 255, 0];\n const endColor = [255, 0, 0];\n const color = lerpColor(startColor, endColor, normalizedAlpha);\n this.heatGraphics.rect(\n marginRegion.outer.x,\n marginRegion.outer.y,\n marginRegion.outer.width,\n marginRegion.outer.height\n );\n this.heatGraphics.fill({ color, alpha: Math.min(0.3, normalizedAlpha) });\n this.heatGraphics.stroke({ color, alpha: Math.max(0.3, normalizedAlpha), pixelLine: true });\n }\n this.position.set(target.x, target.y);\n }\n /**\n * Reset the debug object's state\n */\n reset() {\n this.graphics.forEach((graphics) => graphics.clear());\n this.heatGraphics.clear();\n this.removeFromParent();\n }\n /**\n * Draw a box with a cut-out center\n */\n drawCutBox(graphics, outer, inner, color, alpha) {\n const { x, y, width, height } = outer;\n const { x: innerX, y: innerY, width: innerWidth, height: innerHeight } = inner;\n graphics.rect(x, y, width, height);\n graphics.fill({ color, alpha });\n graphics.rect(innerX, innerY, innerWidth, innerHeight);\n graphics.cut();\n }\n}\nexport {\n DebugNode\n};\n//# sourceMappingURL=DebugNode.mjs.map\n","var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nimport { Container, Rectangle, BigPool } from \"pixi.js\";\nimport { DebugRegionType, calculateRegions } from \"./calculateDebugRegions.mjs\";\nimport { DebugNode } from \"./DebugNode.mjs\";\nclass DebugRenderer {\n constructor() {\n /** Container for all debug visuals */\n __publicField(this, \"holder\", new Container());\n /** Region data for each debug type */\n __publicField(this, \"regions\", /* @__PURE__ */ new Map());\n /** Color configuration for each region type */\n __publicField(this, \"colors\", {\n [DebugRegionType.Margin]: \"#B68655\",\n [DebugRegionType.Padding]: \"#BAC57F\",\n [DebugRegionType.Border]: \"#E7C583\",\n [DebugRegionType.Content]: \"#89B1BE\",\n [DebugRegionType.Flex]: \"#6E28D9\"\n });\n /** Global alpha value for all regions */\n __publicField(this, \"alpha\", 0.75);\n Object.values(DebugRegionType).forEach((type) => {\n this.regions.set(type, {\n outer: new Rectangle(),\n inner: new Rectangle()\n });\n });\n this.holder.__devtoolIgnore = true;\n this.holder.__devtoolIgnoreChildren = true;\n this.holder.eventMode = \"none\";\n this.holder.interactiveChildren = false;\n }\n /**\n * Clean up previous render state\n */\n reset() {\n for (let i = this.holder.children.length - 1; i >= 0; i--) {\n const child = this.holder.children[i];\n BigPool.return(child);\n }\n }\n /**\n * Render debug visuals for the given layout\n */\n render(layout) {\n calculateRegions(layout, this.regions);\n const regionData = Object.values(DebugRegionType).reduce(\n (acc, type) => {\n const region = this.regions.get(type);\n if (!region) return acc;\n const drawString = `debugDraw${type.charAt(0).toUpperCase()}${type.slice(1)}`;\n acc[type] = {\n ...region,\n color: this.colors[type],\n draw: layout._styles.custom[drawString] ?? true\n };\n return acc;\n },\n {}\n );\n const { left, top } = layout.computedLayout;\n const pos = layout.target.getGlobalPosition();\n const debugObject = BigPool.get(DebugNode, {\n ...regionData,\n target: { x: pos.x + left, y: pos.y + top },\n alpha: this.alpha,\n heat: {\n invalidationCount: layout._modificationCount,\n draw: layout._styles.custom.debugHeat !== false\n },\n heatOnly: !layout._styles.custom.debug\n });\n this.holder.addChildAt(debugObject, 0);\n }\n /**\n * Clean up the debug renderer\n */\n destroy() {\n this.reset();\n this.holder.destroy();\n this.regions.clear();\n }\n}\nexport {\n DebugRenderer\n};\n//# sourceMappingURL=DebugRenderer.mjs.map\n"],"names":["DebugRegionType","DebugRegionType2","getEdgeValues","layout","type","method","Edge","calculateRegions","regions","width","height","margin","border","padding","marginRegion","borderRegion","paddingRegion","calculateFlexRegion","_a","flexRegion","bounds","Bounds","children","i","computedBounds","Rectangle","flexDir","FlexDirection","__defProp","__defNormalProp","obj","key","value","__publicField","lerpColor","start","end","t","r","g","b","DebugNode","Container","graphics","Graphics$1","target","alpha","heat","region","x","y","invalidationCount","draw","normalizedAlpha","color","outer","inner","innerX","innerY","innerWidth","innerHeight","DebugRenderer","child","BigPool","regionData","acc","drawString","left","top","pos","debugObject"],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,OAAO+D,CAAU,KAAK;AAAA,QAC5C,GACMD;AAAA,MACR;AAAA,MACD,CAAA;AAAA,IACD,GACK,EAAE,MAAAE,GAAM,KAAAC,EAAK,IAAGjE,EAAO,gBACvBkE,IAAMlE,EAAO,OAAO,kBAAmB,GACvCmE,IAAcP,EAAQ,IAAItB,GAAW;AAAA,MACzC,GAAGuB;AAAA,MACH,QAAQ,EAAE,GAAGK,EAAI,IAAIF,GAAM,GAAGE,EAAI,IAAID,EAAK;AAAA,MAC3C,OAAO,KAAK;AAAA,MACZ,MAAM;AAAA,QACJ,mBAAmBjE,EAAO;AAAA,QAC1B,MAAMA,EAAO,QAAQ,OAAO,cAAc;AAAA,MAC3C;AAAA,MACD,UAAU,CAACA,EAAO,QAAQ,OAAO;AAAA,IACvC,CAAK;AACD,SAAK,OAAO,WAAWmE,GAAa,CAAC;AAAA,EACzC;AAAA;AAAA;AAAA;AAAA,EAIE,UAAU;AACR,SAAK,MAAO,GACZ,KAAK,OAAO,QAAS,GACrB,KAAK,QAAQ,MAAO;AAAA,EACxB;AACA;","x_google_ignoreList":[0,1,2]}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { FederatedPointerEvent } from 'pixi.js';
|
|
2
|
+
import { ControlsDirective } from '../directives/Controls';
|
|
3
|
+
import { JoystickControls } from '../directives/JoystickControls';
|
|
4
|
+
import { Element } from '../engine/reactive';
|
|
2
5
|
|
|
3
6
|
/**
|
|
4
7
|
* Button states for visual feedback
|
|
@@ -74,6 +77,16 @@ export interface ButtonProps {
|
|
|
74
77
|
visible?: boolean;
|
|
75
78
|
/** Button cursor */
|
|
76
79
|
cursor?: string;
|
|
80
|
+
/** Controls instance to automatically apply button events to (e.g., ControlsDirective or JoystickControls) */
|
|
81
|
+
controls?: ControlsDirective | JoystickControls | any;
|
|
82
|
+
/** Name of the control to trigger with applyControl when button is clicked */
|
|
83
|
+
controlName?: string;
|
|
84
|
+
/** Shape of the button background: 'rect', 'circle', or 'ellipse' */
|
|
85
|
+
shape?: 'rect' | 'circle' | 'ellipse';
|
|
86
|
+
/** Custom background component or element (replaces default background if provided) */
|
|
87
|
+
background?: Element | any;
|
|
88
|
+
/** Custom children components for button content (takes priority over text if provided) */
|
|
89
|
+
children?: Element[];
|
|
77
90
|
}
|
|
78
91
|
/**
|
|
79
92
|
* Creates a Button component with interactive states and customizable styling.
|
|
@@ -85,18 +98,52 @@ export interface ButtonProps {
|
|
|
85
98
|
* The button is built using a Container with background and text elements,
|
|
86
99
|
* providing reactive state management and event handling.
|
|
87
100
|
*
|
|
88
|
-
*
|
|
101
|
+
* ## Features
|
|
102
|
+
*
|
|
103
|
+
* - **Controls Integration**: Automatically trigger controls via `applyControl` when clicked
|
|
104
|
+
* - **Multiple Shapes**: Support for rect, circle, and ellipse shapes
|
|
105
|
+
* - **Custom Content**: Use children components for custom button content
|
|
106
|
+
* - **Custom Background**: Provide a custom background component
|
|
107
|
+
*
|
|
108
|
+
* @param props - Button configuration including text, styling, controls, shape, and event handlers
|
|
89
109
|
* @returns A reactive Button component
|
|
90
110
|
* @example
|
|
91
111
|
* ```typescript
|
|
92
112
|
* // Simple button with text and click handler
|
|
93
113
|
* const simpleButton = Button({
|
|
94
114
|
* text: "Click Me",
|
|
95
|
-
*
|
|
115
|
+
* click: () => console.log("Button clicked!"),
|
|
96
116
|
* width: 150,
|
|
97
117
|
* height: 50
|
|
98
118
|
* });
|
|
99
119
|
*
|
|
120
|
+
* // Button with controls integration
|
|
121
|
+
* const jumpButton = Button({
|
|
122
|
+
* text: "Jump",
|
|
123
|
+
* controls: controlsInstance,
|
|
124
|
+
* controlName: "jump",
|
|
125
|
+
* width: 120,
|
|
126
|
+
* height: 40
|
|
127
|
+
* });
|
|
128
|
+
*
|
|
129
|
+
* // Circular button
|
|
130
|
+
* const circleButton = Button({
|
|
131
|
+
* text: "Action",
|
|
132
|
+
* shape: "circle",
|
|
133
|
+
* width: 100,
|
|
134
|
+
* height: 100
|
|
135
|
+
* });
|
|
136
|
+
*
|
|
137
|
+
* // Button with custom content (children)
|
|
138
|
+
* const customButton = Button({
|
|
139
|
+
* shape: "circle",
|
|
140
|
+
* width: 80,
|
|
141
|
+
* height: 80,
|
|
142
|
+
* children: [
|
|
143
|
+
* h(Sprite, { image: "icon.png", width: 50, height: 50 })
|
|
144
|
+
* ]
|
|
145
|
+
* });
|
|
146
|
+
*
|
|
100
147
|
* // Styled button with custom colors
|
|
101
148
|
* const styledButton = Button({
|
|
102
149
|
* text: "Styled Button",
|
|
@@ -132,5 +179,5 @@ export interface ButtonProps {
|
|
|
132
179
|
* });
|
|
133
180
|
* ```
|
|
134
181
|
*/
|
|
135
|
-
export declare function Button(props: ButtonProps):
|
|
182
|
+
export declare function Button(props: ButtonProps): Element<import('./DisplayObject').ComponentInstance> | Promise<Element<import('./DisplayObject').ComponentInstance>>;
|
|
136
183
|
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAMhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C;;GAEG;AACH,oBAAY,WAAW;IACrB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,sCAAsC;IACtC,eAAe,CAAC,EAAE;QAChB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CA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B,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../src/components/Canvas.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,EAIN,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAgB7C,MAAM,WAAW,WAAY,SAAQ,KAAK;IACxC,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC;IACzB,KAAK,CAAC,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACjC,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,WAAW,CAwGjD,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface JoystickChangeEvent {
|
|
2
|
+
angle: number;
|
|
3
|
+
direction: Direction;
|
|
4
|
+
power: number;
|
|
5
|
+
}
|
|
6
|
+
export declare enum Direction {
|
|
7
|
+
LEFT = "left",
|
|
8
|
+
TOP = "top",
|
|
9
|
+
BOTTOM = "bottom",
|
|
10
|
+
RIGHT = "right",
|
|
11
|
+
TOP_LEFT = "top_left",
|
|
12
|
+
TOP_RIGHT = "top_right",
|
|
13
|
+
BOTTOM_LEFT = "bottom_left",
|
|
14
|
+
BOTTOM_RIGHT = "bottom_right"
|
|
15
|
+
}
|
|
16
|
+
export interface JoystickSettings {
|
|
17
|
+
outer?: string;
|
|
18
|
+
inner?: string;
|
|
19
|
+
outerScale?: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
};
|
|
23
|
+
innerScale?: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
};
|
|
27
|
+
innerColor?: string;
|
|
28
|
+
outerColor?: string;
|
|
29
|
+
onChange?: (data: JoystickChangeEvent) => void;
|
|
30
|
+
onStart?: () => void;
|
|
31
|
+
onEnd?: () => void;
|
|
32
|
+
/** Controls instance to automatically apply joystick events to (e.g., JoystickControls or ControlsDirective) */
|
|
33
|
+
controls?: any;
|
|
34
|
+
}
|
|
35
|
+
export declare function Joystick(opts?: JoystickSettings): import('../').Element<import('./DisplayObject').ComponentInstance> | Promise<import('../').Element<import('./DisplayObject').ComponentInstance>>;
|
|
36
|
+
//# sourceMappingURL=Joystick.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Joystick.d.ts","sourceRoot":"","sources":["../../src/components/Joystick.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,SAAS;IACnB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,SAAS,cAAc;IACvB,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,UAAU,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,gHAAgH;IAChH,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB;AAED,wBAAgB,QAAQ,CAAC,IAAI,GAAE,gBAAqB,oJAgUnD"}
|
|
@@ -113,6 +113,8 @@ export declare class CanvasSprite extends CanvasSprite_base {
|
|
|
113
113
|
private sheetCurrentAnimation;
|
|
114
114
|
private app;
|
|
115
115
|
onFinish: () => void;
|
|
116
|
+
private globalLoader;
|
|
117
|
+
private trackedAssetIds;
|
|
116
118
|
get renderer(): import('pixi.js').Renderer;
|
|
117
119
|
private currentAnimationContainer;
|
|
118
120
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sprite.d.ts","sourceRoot":"","sources":["../../src/components/Sprite.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAIL,MAAM,IAAI,UAAU,EAEpB,OAAO,EACR,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,OAAO,EAIR,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO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UAAU,EAAE,yBAAyB,CAAC;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,GAAG,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;KACvB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;QACxC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;KACzC,CAAC;CACH;AAED,MAAM,MAAM,eAAe,GAAG,oBAAoB,GAAG,oBAAoB,CAAC;AAG1E,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,eAAe,CAErD,CAAC"}
|
|
@@ -14,4 +14,5 @@ export { type ComponentInstance } from './DisplayObject';
|
|
|
14
14
|
export { DOMContainer } from './DOMContainer';
|
|
15
15
|
export { DOMElement } from './DOMElement';
|
|
16
16
|
export { Button, ButtonState, type ButtonProps, type ButtonStyle } from './Button';
|
|
17
|
+
export { Joystick, type JoystickSettings, type JoystickChangeEvent } from './Joystick';
|
|
17
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,E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AACnD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA;AAClF,OAAO,EAAE,QAAQ,EAAE,KAAK,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -193,124 +193,6 @@ export interface TexturesOptions extends TextureOptions, TransformOptions {
|
|
|
193
193
|
animations: AnimationFrames;
|
|
194
194
|
}
|
|
195
195
|
export interface SpritesheetOptions extends TransformOptions, TextureOptions {
|
|
196
|
-
/**
|
|
197
|
-
* Object containing all animations.
|
|
198
|
-
* The key to the object is the name of the animation. The value is a two-dimensional array
|
|
199
|
-
*
|
|
200
|
-
* ```ts
|
|
201
|
-
* textures: {
|
|
202
|
-
* myanim: {
|
|
203
|
-
* animations: [
|
|
204
|
-
* [ { time: 0, frameX: 0, frameY: 0 } ]
|
|
205
|
-
* ]
|
|
206
|
-
* }
|
|
207
|
-
* }
|
|
208
|
-
* ```
|
|
209
|
-
*
|
|
210
|
-
* The first array represents an animation group. You can put several of them together to create an animation cluster. For example, several explosions with the same spritesheet
|
|
211
|
-
* The second array represents the animation itself which will animate over time. The object indicates, over a period of time (in frame), which part of the spritesheet will be taken (`frameX`, `frameY`)
|
|
212
|
-
*
|
|
213
|
-
* Here are the properties:
|
|
214
|
-
*
|
|
215
|
-
* * `time`: Time in frame
|
|
216
|
-
* * `frameX`: Retrieve a frame from the spritesheet on the X-axis
|
|
217
|
-
* * `frameY`: Retrieve a frame from the spritesheet on the Y-axis
|
|
218
|
-
* * `opacity`
|
|
219
|
-
* * `pivot`
|
|
220
|
-
* * `anchor`
|
|
221
|
-
* * `rotation`
|
|
222
|
-
* * `angle`
|
|
223
|
-
* * `scale`
|
|
224
|
-
* * `skew`
|
|
225
|
-
* * `x`
|
|
226
|
-
* * `y`
|
|
227
|
-
* * `visible`
|
|
228
|
-
* * `sound`: The sound that will be played during the frame
|
|
229
|
-
*
|
|
230
|
-
* ---
|
|
231
|
-
* **Extract Animation of Spritesheet**
|
|
232
|
-
*
|
|
233
|
-
* Sometimes the animation is part of the image
|
|
234
|
-
*
|
|
235
|
-
* ```ts
|
|
236
|
-
* textures: {
|
|
237
|
-
* myanim: {
|
|
238
|
-
* rectWidth: 64,
|
|
239
|
-
* rectHeight: 64,
|
|
240
|
-
* framesWidth: 10,
|
|
241
|
-
* framesHeight: 2,
|
|
242
|
-
* offset: {x: 0, y: 230},
|
|
243
|
-
* sound: 'my-sound-id', // You can put a sound just for the animation
|
|
244
|
-
* animations: [
|
|
245
|
-
* [ { time: 0, frameX: 0, frameY: 0 } ]
|
|
246
|
-
* ]
|
|
247
|
-
* }
|
|
248
|
-
* }
|
|
249
|
-
* ```
|
|
250
|
-
*
|
|
251
|
-
* Above, we can specify which part we want to recover
|
|
252
|
-
*
|
|
253
|
-
* 1. We go to the position {0, 230} of the image (`offset`)
|
|
254
|
-
* 2. We recover cells of 64px (`rectWidth` and `rectHeight`)
|
|
255
|
-
* 3. And we get 20 cells (10 on the width, 2 on the height) (`frameX` and `frameY`)
|
|
256
|
-
*
|
|
257
|
-
* ---
|
|
258
|
-
*
|
|
259
|
-
* **Advanced**
|
|
260
|
-
*
|
|
261
|
-
* You can create an animation that will be linked to a data. For example, different animation according to a direction of the character.
|
|
262
|
-
*
|
|
263
|
-
* Full example:
|
|
264
|
-
*
|
|
265
|
-
* ```ts
|
|
266
|
-
* import { Spritesheet, Animation, Direction } from '@rpgjs/client'
|
|
267
|
-
*
|
|
268
|
-
* @Spritesheet({
|
|
269
|
-
* id: 'chest',
|
|
270
|
-
* image: require('./assets/chest.png'),
|
|
271
|
-
* width: 124,
|
|
272
|
-
* height: 61,
|
|
273
|
-
* framesHeight: 2,
|
|
274
|
-
* framesWidth: 4,
|
|
275
|
-
* textures: {
|
|
276
|
-
* [Animation.Stand]: {
|
|
277
|
-
* animations: direction => [[ {time: 0, frameX: 3, frameY: direction == Direction.Up ? 0 : 1 } ]]
|
|
278
|
-
* }
|
|
279
|
-
* })
|
|
280
|
-
* })
|
|
281
|
-
* export class Chest { }
|
|
282
|
-
* ```
|
|
283
|
-
*
|
|
284
|
-
* > It is important to know that `Animation.Stand` animation is called if it exists. it only works in the case of an event that doesn't move. The direction is then sent
|
|
285
|
-
*
|
|
286
|
-
* As you can see, the property contains a function that returns the array for the animation. Here, it is the direction but the parameters depend on the call of the animation. Example:
|
|
287
|
-
*
|
|
288
|
-
* ```ts
|
|
289
|
-
* import { Spritesheet, Animation, Direction, RpgSprite, ISpriteCharacter } from '@rpgjs/client'
|
|
290
|
-
*
|
|
291
|
-
* @Spritesheet({
|
|
292
|
-
* id: 'chest',
|
|
293
|
-
* image: require('./assets/chest.png'),
|
|
294
|
-
* width: 124,
|
|
295
|
-
* height: 61,
|
|
296
|
-
* framesHeight: 2,
|
|
297
|
-
* framesWidth: 4,
|
|
298
|
-
* textures: {
|
|
299
|
-
* [Animation.Stand]: {
|
|
300
|
-
* animations: str => [[ {time: 0, frameX: 3, frameY: str == 'hello' ? 0 : 1 } ]]
|
|
301
|
-
* }
|
|
302
|
-
* }
|
|
303
|
-
* })
|
|
304
|
-
* export class Chest implements ISpriteCharacter {
|
|
305
|
-
* onCharacterStand(sprite: RpgSprite) {
|
|
306
|
-
* sprite.animation.play(Animation.Stand, ['hello'])
|
|
307
|
-
* }
|
|
308
|
-
* }
|
|
309
|
-
* ```
|
|
310
|
-
*
|
|
311
|
-
* @prop { { [animName: string]: { animations: Array<Array<FrameOptions>> | Function, ...other } } } [textures]
|
|
312
|
-
* @memberof Spritesheet
|
|
313
|
-
* */
|
|
314
196
|
textures?: {
|
|
315
197
|
[animationName: string]: Partial<TexturesOptions> & Pick<TexturesOptions, 'animations'>;
|
|
316
198
|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AC,eAAe,EAAE,YAAY,CAAC,CAAA;KAC1F,CAAA;CACJ;AAED,KAAK,uBAAuB,GAAG,kBAAkB,GAAG;IAChD;;;;;;;;;;;;SAYK;IACL,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;QAOI;IACJ,EAAE,EAAE,MAAM,CAAA;CACb,CAAA;AACD,KAAK,wBAAwB,GAAG,kBAAkB,GAAG;IACjD;;;;;;;;;;;;;;SAcK;IACL,MAAM,CAAC,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACpC,CAAA;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,uBAAuB,OAAC;AAC7D,wBAAgB,WAAW,CAAC,OAAO,EAAE,wBAAwB,OAAC"}
|
|
@@ -3,14 +3,15 @@ import { Element } from '../engine/reactive';
|
|
|
3
3
|
import { Controls } from './ControlsBase';
|
|
4
4
|
import { KeyboardControls } from './KeyboardControls';
|
|
5
5
|
import { GamepadControls } from './GamepadControls';
|
|
6
|
+
import { JoystickControls } from './JoystickControls';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
|
-
* Controls directive that coordinates keyboard and
|
|
9
|
+
* Controls directive that coordinates keyboard, gamepad, and joystick input systems
|
|
9
10
|
*
|
|
10
|
-
* This directive automatically activates
|
|
11
|
+
* This directive automatically activates keyboard, gamepad, and joystick controls when available.
|
|
11
12
|
* The gamepad is automatically enabled if joypad.js is detected in the environment.
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
+
* All systems share the same control configuration and can work simultaneously.
|
|
14
15
|
*
|
|
15
16
|
* @example
|
|
16
17
|
* ```html
|
|
@@ -25,9 +26,10 @@ import { GamepadControls } from './GamepadControls';
|
|
|
25
26
|
export declare class ControlsDirective extends Directive {
|
|
26
27
|
private keyboardControls;
|
|
27
28
|
private gamepadControls;
|
|
29
|
+
private joystickControls;
|
|
28
30
|
/**
|
|
29
31
|
* Initialize the controls directive
|
|
30
|
-
* Sets up keyboard and
|
|
32
|
+
* Sets up keyboard, gamepad, and joystick controls if available
|
|
31
33
|
*/
|
|
32
34
|
onInit(element: Element): void;
|
|
33
35
|
/**
|
|
@@ -66,17 +68,18 @@ export declare class ControlsDirective extends Directive {
|
|
|
66
68
|
*
|
|
67
69
|
* @param controlName - Name of the control
|
|
68
70
|
* @param isDown - Whether the control is pressed (true) or released (false)
|
|
71
|
+
* @param payload - Optional payload to pass to keyDown/keyUp callbacks (e.g., { power: 0.8 })
|
|
69
72
|
* @returns Promise that resolves when the action is complete
|
|
70
73
|
*/
|
|
71
|
-
applyControl(controlName: string | number, isDown?: boolean): Promise<void>;
|
|
74
|
+
applyControl(controlName: string | number, isDown?: boolean, payload?: any): Promise<void>;
|
|
72
75
|
/**
|
|
73
76
|
* Stop listening to inputs
|
|
74
|
-
* Stops
|
|
77
|
+
* Stops keyboard, gamepad, and joystick input processing
|
|
75
78
|
*/
|
|
76
79
|
stopInputs(): void;
|
|
77
80
|
/**
|
|
78
81
|
* Resume listening to inputs
|
|
79
|
-
* Resumes
|
|
82
|
+
* Resumes keyboard, gamepad, and joystick input processing
|
|
80
83
|
*/
|
|
81
84
|
listenInputs(): void;
|
|
82
85
|
/**
|
|
@@ -98,5 +101,11 @@ export declare class ControlsDirective extends Directive {
|
|
|
98
101
|
* @returns GamepadControls instance or null
|
|
99
102
|
*/
|
|
100
103
|
get gamepad(): GamepadControls | null;
|
|
104
|
+
/**
|
|
105
|
+
* Get the joystick controls instance
|
|
106
|
+
*
|
|
107
|
+
* @returns JoystickControls instance or null
|
|
108
|
+
*/
|
|
109
|
+
get joystick(): JoystickControls | null;
|
|
101
110
|
}
|
|
102
111
|
//# sourceMappingURL=Controls.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Controls.d.ts","sourceRoot":"","sources":["../../src/directives/Controls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAqB,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,O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;;OAGG;IACH,YAAY;IAYZ;;;;;OAKG;IACH,IAAI,OAAO,IAAI,QAAQ,CAEtB;IAED;;;;OAIG;IACH,IAAI,QAAQ,IAAI,gBAAgB,GAAG,IAAI,CAEtC;IAED;;;;OAIG;IACH,IAAI,OAAO,IAAI,eAAe,GAAG,IAAI,CAEpC;IAED;;;;OAIG;IACH,IAAI,QAAQ,IAAI,gBAAgB,GAAG,IAAI,CAEtC;CACJ"}
|
|
@@ -85,6 +85,7 @@ export declare class GamepadControls extends ControlsBase {
|
|
|
85
85
|
private joypad;
|
|
86
86
|
private connectCallbacks;
|
|
87
87
|
private disconnectCallbacks;
|
|
88
|
+
private currentPower;
|
|
88
89
|
/**
|
|
89
90
|
* Setup gamepad event listeners
|
|
90
91
|
* Initializes joypad.js if available
|
|
@@ -157,9 +158,10 @@ export declare class GamepadControls extends ControlsBase {
|
|
|
157
158
|
*
|
|
158
159
|
* @param controlName - Name of the control
|
|
159
160
|
* @param isDown - Whether the control is pressed (true) or released (false)
|
|
161
|
+
* @param payload - Optional payload to pass to keyDown/keyUp callbacks (e.g., { power: 0.8 })
|
|
160
162
|
* @returns Promise that resolves when the action is complete
|
|
161
163
|
*/
|
|
162
|
-
applyControl(controlName: string | number, isDown?: boolean): Promise<void>;
|
|
164
|
+
applyControl(controlName: string | number, isDown?: boolean, payload?: any): Promise<void>;
|
|
163
165
|
/**
|
|
164
166
|
* Override setInputs to extract gamepad config
|
|
165
167
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GamepadControls.d.ts","sourceRoot":"","sources":["../../src/directives/GamepadControls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,WAAW,CAAA;AAElB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,aAAa;IAC1B,iDAAiD;IAC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