@datamoc/mw_games 0.7.4 → 0.7.7
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/CHANGELOG.md +287 -2
- package/README.md +15 -2
- package/dist/actors/Inventory.d.ts +7 -1
- package/dist/actors/Inventory.d.ts.map +1 -1
- package/dist/actors/Inventory.js.map +1 -1
- package/dist/actors/craft.d.ts +35 -14
- package/dist/actors/craft.d.ts.map +1 -1
- package/dist/actors/craft.js +56 -24
- package/dist/actors/craft.js.map +1 -1
- package/dist/actors/index.d.ts +1 -1
- package/dist/actors/index.d.ts.map +1 -1
- package/dist/ai/Heuristics.d.ts +232 -0
- package/dist/ai/Heuristics.d.ts.map +1 -0
- package/dist/ai/Heuristics.js +298 -0
- package/dist/ai/Heuristics.js.map +1 -0
- package/dist/ai/index.d.ts +4 -0
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +2 -0
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/score.d.ts +126 -0
- package/dist/ai/score.d.ts.map +1 -0
- package/dist/ai/score.js +121 -0
- package/dist/ai/score.js.map +1 -0
- package/dist/assets/loader.d.ts +18 -4
- package/dist/assets/loader.d.ts.map +1 -1
- package/dist/assets/loader.js +40 -11
- package/dist/assets/loader.js.map +1 -1
- package/dist/audio/Positional.d.ts +125 -0
- package/dist/audio/Positional.d.ts.map +1 -0
- package/dist/audio/Positional.js +135 -0
- package/dist/audio/Positional.js.map +1 -0
- package/dist/audio/Sound.d.ts +7 -1
- package/dist/audio/Sound.d.ts.map +1 -1
- package/dist/audio/Sound.js +8 -2
- package/dist/audio/Sound.js.map +1 -1
- package/dist/audio/index.d.ts +2 -0
- package/dist/audio/index.d.ts.map +1 -1
- package/dist/audio/index.js +1 -0
- package/dist/audio/index.js.map +1 -1
- package/dist/battle/AttackDialog.d.ts +75 -0
- package/dist/battle/AttackDialog.d.ts.map +1 -0
- package/dist/battle/AttackDialog.js +115 -0
- package/dist/battle/AttackDialog.js.map +1 -0
- package/dist/battle/AttackPreview.d.ts +70 -0
- package/dist/battle/AttackPreview.d.ts.map +1 -0
- package/dist/battle/AttackPreview.js +78 -0
- package/dist/battle/AttackPreview.js.map +1 -0
- package/dist/battle/BattleStats.d.ts +45 -0
- package/dist/battle/BattleStats.d.ts.map +1 -0
- package/dist/battle/BattleStats.js +63 -0
- package/dist/battle/BattleStats.js.map +1 -0
- package/dist/battle/UnitSelector.d.ts +72 -0
- package/dist/battle/UnitSelector.d.ts.map +1 -0
- package/dist/battle/UnitSelector.js +117 -0
- package/dist/battle/UnitSelector.js.map +1 -0
- package/dist/battle/Whiteboard.d.ts +50 -0
- package/dist/battle/Whiteboard.d.ts.map +1 -0
- package/dist/battle/Whiteboard.js +94 -0
- package/dist/battle/Whiteboard.js.map +1 -0
- package/dist/battle/index.d.ts +10 -0
- package/dist/battle/index.d.ts.map +1 -1
- package/dist/battle/index.js +5 -0
- package/dist/battle/index.js.map +1 -1
- package/dist/board/FogOfWar.d.ts +32 -2
- package/dist/board/FogOfWar.d.ts.map +1 -1
- package/dist/board/FogOfWar.js +70 -6
- package/dist/board/FogOfWar.js.map +1 -1
- package/dist/core/Achievements.d.ts +40 -7
- package/dist/core/Achievements.d.ts.map +1 -1
- package/dist/core/Achievements.js +51 -7
- package/dist/core/Achievements.js.map +1 -1
- package/dist/core/Blob.d.ts +13 -2
- package/dist/core/Blob.d.ts.map +1 -1
- package/dist/core/Blob.js +16 -2
- package/dist/core/Blob.js.map +1 -1
- package/dist/core/Hex.d.ts +26 -6
- package/dist/core/Hex.d.ts.map +1 -1
- package/dist/core/Hex.js +40 -13
- package/dist/core/Hex.js.map +1 -1
- package/dist/core/Input.d.ts +36 -0
- package/dist/core/Input.d.ts.map +1 -1
- package/dist/core/Input.js +63 -1
- package/dist/core/Input.js.map +1 -1
- package/dist/core/Random.d.ts +93 -0
- package/dist/core/Random.d.ts.map +1 -1
- package/dist/core/Random.js +177 -0
- package/dist/core/Random.js.map +1 -1
- package/dist/core/SyncGuard.d.ts +57 -0
- package/dist/core/SyncGuard.d.ts.map +1 -0
- package/dist/core/SyncGuard.js +116 -0
- package/dist/core/SyncGuard.js.map +1 -0
- package/dist/core/index.d.ts +3 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -1
- package/dist/core/index.js.map +1 -1
- package/dist/i18n/Po.d.ts +51 -0
- package/dist/i18n/Po.d.ts.map +1 -0
- package/dist/i18n/Po.js +176 -0
- package/dist/i18n/Po.js.map +1 -0
- package/dist/i18n/index.d.ts +2 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +1 -0
- package/dist/i18n/index.js.map +1 -1
- package/dist/mw_games.global.js +104 -98
- package/dist/mwl/MapFile.d.ts +41 -0
- package/dist/mwl/MapFile.d.ts.map +1 -0
- package/dist/mwl/MapFile.js +43 -0
- package/dist/mwl/MapFile.js.map +1 -0
- package/dist/mwl/campaign.d.ts +51 -0
- package/dist/mwl/campaign.d.ts.map +1 -0
- package/dist/mwl/campaign.js +58 -0
- package/dist/mwl/campaign.js.map +1 -0
- package/dist/mwl/carryover.d.ts +79 -0
- package/dist/mwl/carryover.d.ts.map +1 -0
- package/dist/mwl/carryover.js +63 -0
- package/dist/mwl/carryover.js.map +1 -0
- package/dist/mwl/content.d.ts +10 -0
- package/dist/mwl/content.d.ts.map +1 -1
- package/dist/mwl/content.js +8 -0
- package/dist/mwl/content.js.map +1 -1
- package/dist/mwl/hooks.d.ts +6 -5
- package/dist/mwl/hooks.d.ts.map +1 -1
- package/dist/mwl/hooks.js.map +1 -1
- package/dist/mwl/index.d.ts +8 -2
- package/dist/mwl/index.d.ts.map +1 -1
- package/dist/mwl/index.js +4 -1
- package/dist/mwl/index.js.map +1 -1
- package/dist/mwl/runtime.d.ts +140 -7
- package/dist/mwl/runtime.d.ts.map +1 -1
- package/dist/mwl/runtime.js +427 -33
- package/dist/mwl/runtime.js.map +1 -1
- package/dist/mwl/schema.d.ts.map +1 -1
- package/dist/mwl/schema.js +97 -18
- package/dist/mwl/schema.js.map +1 -1
- package/dist/roguelike/MultiTurnBeam.d.ts +50 -12
- package/dist/roguelike/MultiTurnBeam.d.ts.map +1 -1
- package/dist/roguelike/MultiTurnBeam.js +100 -53
- package/dist/roguelike/MultiTurnBeam.js.map +1 -1
- package/dist/roguelike/Targeting.d.ts +94 -0
- package/dist/roguelike/Targeting.d.ts.map +1 -1
- package/dist/roguelike/Targeting.js +123 -0
- package/dist/roguelike/Targeting.js.map +1 -1
- package/dist/roguelike/index.d.ts +3 -1
- package/dist/roguelike/index.d.ts.map +1 -1
- package/dist/roguelike/index.js +1 -0
- package/dist/roguelike/index.js.map +1 -1
- package/dist/simulation/CampaignSave.d.ts +68 -0
- package/dist/simulation/CampaignSave.d.ts.map +1 -0
- package/dist/simulation/CampaignSave.js +54 -0
- package/dist/simulation/CampaignSave.js.map +1 -0
- package/dist/simulation/EventPresentation.d.ts +111 -0
- package/dist/simulation/EventPresentation.d.ts.map +1 -0
- package/dist/simulation/EventPresentation.js +120 -0
- package/dist/simulation/EventPresentation.js.map +1 -0
- package/dist/simulation/index.d.ts +4 -0
- package/dist/simulation/index.d.ts.map +1 -1
- package/dist/simulation/index.js +2 -0
- package/dist/simulation/index.js.map +1 -1
- package/dist/two-d/pixi-interop.d.ts +18 -6
- package/dist/two-d/pixi-interop.d.ts.map +1 -1
- package/dist/two-d/pixi-interop.js +18 -6
- package/dist/two-d/pixi-interop.js.map +1 -1
- package/dist/two-d/render/AnimatedSprite.d.ts +74 -7
- package/dist/two-d/render/AnimatedSprite.d.ts.map +1 -1
- package/dist/two-d/render/AnimatedSprite.js +88 -26
- package/dist/two-d/render/AnimatedSprite.js.map +1 -1
- package/dist/two-d/render/Camera.d.ts +64 -4
- package/dist/two-d/render/Camera.d.ts.map +1 -1
- package/dist/two-d/render/Camera.js +132 -11
- package/dist/two-d/render/Camera.js.map +1 -1
- package/dist/two-d/render/Halo.d.ts +58 -0
- package/dist/two-d/render/Halo.d.ts.map +1 -0
- package/dist/two-d/render/Halo.js +48 -0
- package/dist/two-d/render/Halo.js.map +1 -0
- package/dist/two-d/render/ImageModifiers.d.ts +174 -0
- package/dist/two-d/render/ImageModifiers.d.ts.map +1 -1
- package/dist/two-d/render/ImageModifiers.js +438 -1
- package/dist/two-d/render/ImageModifiers.js.map +1 -1
- package/dist/two-d/render/LightningArc.d.ts +57 -0
- package/dist/two-d/render/LightningArc.d.ts.map +1 -0
- package/dist/two-d/render/LightningArc.js +91 -0
- package/dist/two-d/render/LightningArc.js.map +1 -0
- package/dist/two-d/render/PaletteRemap.d.ts +135 -0
- package/dist/two-d/render/PaletteRemap.d.ts.map +1 -0
- package/dist/two-d/render/PaletteRemap.js +181 -0
- package/dist/two-d/render/PaletteRemap.js.map +1 -0
- package/dist/two-d/render/Particles.d.ts +26 -0
- package/dist/two-d/render/Particles.d.ts.map +1 -1
- package/dist/two-d/render/Particles.js +23 -2
- package/dist/two-d/render/Particles.js.map +1 -1
- package/dist/two-d/render/SpriteAttachment.d.ts +55 -0
- package/dist/two-d/render/SpriteAttachment.d.ts.map +1 -0
- package/dist/two-d/render/SpriteAttachment.js +60 -0
- package/dist/two-d/render/SpriteAttachment.js.map +1 -0
- package/dist/two-d/render/TerrainGraphics.d.ts +142 -0
- package/dist/two-d/render/TerrainGraphics.d.ts.map +1 -0
- package/dist/two-d/render/TerrainGraphics.js +161 -0
- package/dist/two-d/render/TerrainGraphics.js.map +1 -0
- package/dist/two-d/render/index.d.ts +13 -3
- package/dist/two-d/render/index.d.ts.map +1 -1
- package/dist/two-d/render/index.js +6 -1
- package/dist/two-d/render/index.js.map +1 -1
- package/dist/two-d/stage/StoryScreen.d.ts +110 -0
- package/dist/two-d/stage/StoryScreen.d.ts.map +1 -0
- package/dist/two-d/stage/StoryScreen.js +178 -0
- package/dist/two-d/stage/StoryScreen.js.map +1 -0
- package/dist/two-d/stage/index.d.ts +2 -0
- package/dist/two-d/stage/index.d.ts.map +1 -1
- package/dist/two-d/stage/index.js +1 -0
- package/dist/two-d/stage/index.js.map +1 -1
- package/dist/two-d/ui/Checkbox.d.ts +44 -0
- package/dist/two-d/ui/Checkbox.d.ts.map +1 -0
- package/dist/two-d/ui/Checkbox.js +89 -0
- package/dist/two-d/ui/Checkbox.js.map +1 -0
- package/dist/two-d/ui/DataTable.d.ts +79 -0
- package/dist/two-d/ui/DataTable.d.ts.map +1 -0
- package/dist/two-d/ui/DataTable.js +164 -0
- package/dist/two-d/ui/DataTable.js.map +1 -0
- package/dist/two-d/ui/Dropdown.d.ts +72 -0
- package/dist/two-d/ui/Dropdown.d.ts.map +1 -0
- package/dist/two-d/ui/Dropdown.js +126 -0
- package/dist/two-d/ui/Dropdown.js.map +1 -0
- package/dist/two-d/ui/FloatingText.d.ts +43 -4
- package/dist/two-d/ui/FloatingText.d.ts.map +1 -1
- package/dist/two-d/ui/FloatingText.js +52 -5
- package/dist/two-d/ui/FloatingText.js.map +1 -1
- package/dist/two-d/ui/FloatingTextStack.d.ts +86 -13
- package/dist/two-d/ui/FloatingTextStack.d.ts.map +1 -1
- package/dist/two-d/ui/FloatingTextStack.js +89 -18
- package/dist/two-d/ui/FloatingTextStack.js.map +1 -1
- package/dist/two-d/ui/Layout.d.ts +105 -0
- package/dist/two-d/ui/Layout.d.ts.map +1 -0
- package/dist/two-d/ui/Layout.js +174 -0
- package/dist/two-d/ui/Layout.js.map +1 -0
- package/dist/two-d/ui/ScrollBox.d.ts +67 -0
- package/dist/two-d/ui/ScrollBox.d.ts.map +1 -0
- package/dist/two-d/ui/ScrollBox.js +127 -0
- package/dist/two-d/ui/ScrollBox.js.map +1 -0
- package/dist/two-d/ui/Skins.d.ts +59 -0
- package/dist/two-d/ui/Skins.d.ts.map +1 -0
- package/dist/two-d/ui/Skins.js +77 -0
- package/dist/two-d/ui/Skins.js.map +1 -0
- package/dist/two-d/ui/Slider.d.ts +91 -0
- package/dist/two-d/ui/Slider.d.ts.map +1 -0
- package/dist/two-d/ui/Slider.js +170 -0
- package/dist/two-d/ui/Slider.js.map +1 -0
- package/dist/two-d/ui/Spinner.d.ts +67 -0
- package/dist/two-d/ui/Spinner.d.ts.map +1 -0
- package/dist/two-d/ui/Spinner.js +137 -0
- package/dist/two-d/ui/Spinner.js.map +1 -0
- package/dist/two-d/ui/TabbedList.d.ts +118 -0
- package/dist/two-d/ui/TabbedList.d.ts.map +1 -0
- package/dist/two-d/ui/TabbedList.js +221 -0
- package/dist/two-d/ui/TabbedList.js.map +1 -0
- package/dist/two-d/ui/TextModel.d.ts +65 -0
- package/dist/two-d/ui/TextModel.d.ts.map +1 -0
- package/dist/two-d/ui/TextModel.js +126 -0
- package/dist/two-d/ui/TextModel.js.map +1 -0
- package/dist/two-d/ui/TreeView.d.ts +68 -0
- package/dist/two-d/ui/TreeView.d.ts.map +1 -0
- package/dist/two-d/ui/TreeView.js +133 -0
- package/dist/two-d/ui/TreeView.js.map +1 -0
- package/dist/two-d/ui/Window.d.ts +13 -0
- package/dist/two-d/ui/Window.d.ts.map +1 -1
- package/dist/two-d/ui/Window.js +23 -0
- package/dist/two-d/ui/Window.js.map +1 -1
- package/dist/two-d/ui/WindowStack.d.ts.map +1 -1
- package/dist/two-d/ui/WindowStack.js +2 -0
- package/dist/two-d/ui/WindowStack.js.map +1 -1
- package/dist/two-d/ui/index.d.ts +27 -3
- package/dist/two-d/ui/index.d.ts.map +1 -1
- package/dist/two-d/ui/index.js +14 -2
- package/dist/two-d/ui/index.js.map +1 -1
- package/dist/two-d/ui/markup.d.ts +127 -0
- package/dist/two-d/ui/markup.d.ts.map +1 -0
- package/dist/two-d/ui/markup.js +322 -0
- package/dist/two-d/ui/markup.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/world/SideTurns.d.ts +115 -0
- package/dist/world/SideTurns.d.ts.map +1 -0
- package/dist/world/SideTurns.js +138 -0
- package/dist/world/SideTurns.js.map +1 -0
- package/dist/world/index.d.ts +2 -0
- package/dist/world/index.d.ts.map +1 -1
- package/dist/world/index.js +1 -0
- package/dist/world/index.js.map +1 -1
- package/package.json +8 -3
|
@@ -45,11 +45,77 @@ export class Camera {
|
|
|
45
45
|
this.shakeY = 0;
|
|
46
46
|
/** clamps the view to these world bounds when set, so the map's edge is never crossed */
|
|
47
47
|
this.bounds = null;
|
|
48
|
+
this.step = 0;
|
|
49
|
+
//the one true source of the view's turn, in radians; `step` above only tracks where
|
|
50
|
+
//setRotationStep/rotate last left it, for rotationSteps to report. rotateTo/
|
|
51
|
+
//animateRotationTo move this directly, to any angle, not only a step's whole multiple
|
|
52
|
+
this._angle = 0;
|
|
53
|
+
this.targetAngle = null;
|
|
54
|
+
this.angleIntensity = 0;
|
|
55
|
+
if (options.grid !== undefined && options.grid !== 'square' && options.grid !== 'hex')
|
|
56
|
+
throw new Error(`camera grid must be "square" or "hex", not "${options.grid}"`);
|
|
57
|
+
this.stepsPerTurn = options.grid === 'hex' ? 6 : 4;
|
|
48
58
|
this.deadzone = options.deadzone ?? 0;
|
|
49
59
|
this.pixelPerfectTileSize = options.pixelPerfectTileSize;
|
|
50
60
|
this._zoom = 1;
|
|
51
61
|
this.zoom = options.zoom ?? 1;
|
|
52
62
|
}
|
|
63
|
+
/** the rotation step this view is turned to, always in `0 .. stepsPerTurn - 1` */
|
|
64
|
+
get rotationSteps() {
|
|
65
|
+
return this.step;
|
|
66
|
+
}
|
|
67
|
+
/** the view's rotation, in radians, positive turning the world counter-clockwise */
|
|
68
|
+
get rotation() {
|
|
69
|
+
return this._angle;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The angle that cancels `rotation`: draw a label, health bar or damage number into `world`
|
|
73
|
+
* with this and it stays upright however the view is turned. A half turn would otherwise put
|
|
74
|
+
* every label upside down.
|
|
75
|
+
*/
|
|
76
|
+
get uprightRotation() {
|
|
77
|
+
return -this.rotation;
|
|
78
|
+
}
|
|
79
|
+
/** turns the view to a whole step, wrapping around a full turn */
|
|
80
|
+
setRotationStep(step) {
|
|
81
|
+
if (!Number.isInteger(step))
|
|
82
|
+
throw new Error('camera rotation step must be an integer');
|
|
83
|
+
this.step = ((step % this.stepsPerTurn) + this.stepsPerTurn) % this.stepsPerTurn;
|
|
84
|
+
this._angle = (this.step / this.stepsPerTurn) * Math.PI * 2;
|
|
85
|
+
this.targetAngle = null;
|
|
86
|
+
this.apply();
|
|
87
|
+
}
|
|
88
|
+
/** turns the view by whole steps; `rotate(1)` is the next position, `rotate(-1)` the last */
|
|
89
|
+
rotate(delta = 1) {
|
|
90
|
+
this.setRotationStep(this.step + delta);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Turns the view to an arbitrary angle immediately, no animation - free rotation, not
|
|
94
|
+
* confined to a grid's whole steps. `rotationSteps` is left as it was: it names where
|
|
95
|
+
* `setRotationStep`/`rotate` last put the view, not this angle, so the two APIs are best
|
|
96
|
+
* used one at a time rather than interleaved.
|
|
97
|
+
*/
|
|
98
|
+
rotateTo(angle) {
|
|
99
|
+
this._angle = angle;
|
|
100
|
+
this.targetAngle = null;
|
|
101
|
+
this.angleIntensity = 0;
|
|
102
|
+
this.apply();
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Eases the view towards an arbitrary angle, taking whichever way around the turn is
|
|
106
|
+
* shorter - so animating from a hex view's fifth step back to its first sweeps the one
|
|
107
|
+
* 60-degree gap between them rather than the long way around. `intensity` behaves like
|
|
108
|
+
* `follow`'s: the remaining angle closes by that fraction each second.
|
|
109
|
+
*/
|
|
110
|
+
animateRotationTo(angle, intensity = 4) {
|
|
111
|
+
this.targetAngle = angle;
|
|
112
|
+
this.angleIntensity = intensity;
|
|
113
|
+
}
|
|
114
|
+
/** cos/sin of the current rotation, the shared arithmetic `toScreen`/`toWorld`/`view` use */
|
|
115
|
+
get spin() {
|
|
116
|
+
const angle = this.rotation;
|
|
117
|
+
return { cos: Math.cos(angle), sin: Math.sin(angle) };
|
|
118
|
+
}
|
|
53
119
|
get zoom() {
|
|
54
120
|
return this._zoom;
|
|
55
121
|
}
|
|
@@ -69,12 +135,31 @@ export class Camera {
|
|
|
69
135
|
this.screenX = screenX;
|
|
70
136
|
this.screenY = screenY;
|
|
71
137
|
}
|
|
72
|
-
/**
|
|
138
|
+
/**
|
|
139
|
+
* The visible region, in world units, as an axis-aligned box: use it to cull.
|
|
140
|
+
*
|
|
141
|
+
* With the view turned, the visible region is the viewport rectangle rotated in world space,
|
|
142
|
+
* so this is the box around its four corners instead of the rectangle itself - over-inclusive
|
|
143
|
+
* rather than clipping tiles that are actually on screen. Unturned, it is the rectangle, at
|
|
144
|
+
* its exact numbers.
|
|
145
|
+
*/
|
|
73
146
|
get view() {
|
|
74
147
|
const width = this.viewWidth / this._zoom;
|
|
75
148
|
const height = this.viewHeight / this._zoom;
|
|
76
149
|
const { x: centreX, y: centreY } = this.clampedCentre(this.x, this.y);
|
|
77
|
-
|
|
150
|
+
if (this._angle === 0)
|
|
151
|
+
return { x: centreX - width / 2, y: centreY - height / 2, width, height };
|
|
152
|
+
const corners = [
|
|
153
|
+
this.toWorld(this.screenX, this.screenY),
|
|
154
|
+
this.toWorld(this.screenX + this.viewWidth, this.screenY),
|
|
155
|
+
this.toWorld(this.screenX + this.viewWidth, this.screenY + this.viewHeight),
|
|
156
|
+
this.toWorld(this.screenX, this.screenY + this.viewHeight),
|
|
157
|
+
];
|
|
158
|
+
const xs = corners.map((corner) => corner.x);
|
|
159
|
+
const ys = corners.map((corner) => corner.y);
|
|
160
|
+
const minX = Math.min(...xs);
|
|
161
|
+
const minY = Math.min(...ys);
|
|
162
|
+
return { x: minX, y: minY, width: Math.max(...xs) - minX, height: Math.max(...ys) - minY };
|
|
78
163
|
}
|
|
79
164
|
/** stops the camera leaving the map; pass null to allow it again */
|
|
80
165
|
setBounds(bounds) {
|
|
@@ -131,6 +216,13 @@ export class Camera {
|
|
|
131
216
|
this.x += dx * t;
|
|
132
217
|
this.y += dy * t;
|
|
133
218
|
}
|
|
219
|
+
if (this.targetAngle !== null && this.angleIntensity > 0) {
|
|
220
|
+
const diff = angleDiff(this._angle, this.targetAngle);
|
|
221
|
+
//reduced motion jumps straight there in one frame instead of easing continuously,
|
|
222
|
+
//the same trade `update`'s follow-target easing above makes
|
|
223
|
+
const t = reducedMotion() ? 1 : 1 - Math.exp(-this.angleIntensity * dt);
|
|
224
|
+
this._angle += diff * t;
|
|
225
|
+
}
|
|
134
226
|
if (this.shakeRemaining > 0) {
|
|
135
227
|
this.shakeRemaining -= dt;
|
|
136
228
|
//the shake fades out over its duration rather than stopping dead
|
|
@@ -143,24 +235,30 @@ export class Camera {
|
|
|
143
235
|
}
|
|
144
236
|
this.apply();
|
|
145
237
|
}
|
|
146
|
-
/** world point to screen pixels */
|
|
238
|
+
/** world point to screen pixels, through the current rotation */
|
|
147
239
|
toScreen(x, y) {
|
|
148
240
|
//must agree with apply()'s clamped centre (shake included), or a point converted
|
|
149
241
|
//with this and placed on screen lands somewhere other than where the camera
|
|
150
242
|
//actually drew it - exactly what happens near a bound, or on an axis the map is
|
|
151
243
|
//narrower than the view
|
|
152
244
|
const { x: centreX, y: centreY } = this.clampedCentre(this.x + this.shakeX, this.y + this.shakeY);
|
|
245
|
+
const { cos, sin } = this.spin;
|
|
246
|
+
const dx = x - centreX;
|
|
247
|
+
const dy = y - centreY;
|
|
153
248
|
return {
|
|
154
|
-
x: (
|
|
155
|
-
y: (
|
|
249
|
+
x: (dx * cos - dy * sin) * this._zoom + this.screenX + this.viewWidth / 2,
|
|
250
|
+
y: (dx * sin + dy * cos) * this._zoom + this.screenY + this.viewHeight / 2,
|
|
156
251
|
};
|
|
157
252
|
}
|
|
158
|
-
/** screen pixels to world point, for turning a click into a tile */
|
|
253
|
+
/** screen pixels to world point, for turning a click into a tile; the inverse of `toScreen` */
|
|
159
254
|
toWorld(x, y) {
|
|
160
255
|
const { x: centreX, y: centreY } = this.clampedCentre(this.x + this.shakeX, this.y + this.shakeY);
|
|
256
|
+
const { cos, sin } = this.spin;
|
|
257
|
+
const rx = (x - this.screenX - this.viewWidth / 2) / this._zoom;
|
|
258
|
+
const ry = (y - this.screenY - this.viewHeight / 2) / this._zoom;
|
|
161
259
|
return {
|
|
162
|
-
x:
|
|
163
|
-
y:
|
|
260
|
+
x: centreX + rx * cos + ry * sin,
|
|
261
|
+
y: centreY - rx * sin + ry * cos,
|
|
164
262
|
};
|
|
165
263
|
}
|
|
166
264
|
//the bounds-clamped centre `apply()` renders at, also what `view` reports for
|
|
@@ -181,14 +279,37 @@ export class Camera {
|
|
|
181
279
|
apply() {
|
|
182
280
|
const { x: centreX, y: centreY } = this.clampedCentre(this.x + this.shakeX, this.y + this.shakeY);
|
|
183
281
|
this.world.scale.set(this._zoom);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
282
|
+
if (this._angle === 0) {
|
|
283
|
+
//unturned: rotate about the origin, the transform every existing camera had
|
|
284
|
+
this.world.rotation = 0;
|
|
285
|
+
this.world.pivot.set(0, 0);
|
|
286
|
+
//rounding to whole screen pixels stops pixel art shimmering as the camera moves
|
|
287
|
+
this.world.x = Math.round(this.screenX + this.viewWidth / 2 - centreX * this._zoom);
|
|
288
|
+
this.world.y = Math.round(this.screenY + this.viewHeight / 2 - centreY * this._zoom);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
//turned: pivot on the view centre so the layer turns about what the player is looking
|
|
292
|
+
//at, and the centre lands on the same screen point the unturned camera would use
|
|
293
|
+
this.world.rotation = this.rotation;
|
|
294
|
+
this.world.pivot.set(centreX, centreY);
|
|
295
|
+
this.world.x = Math.round(this.screenX + this.viewWidth / 2);
|
|
296
|
+
this.world.y = Math.round(this.screenY + this.viewHeight / 2);
|
|
187
297
|
}
|
|
188
298
|
}
|
|
189
299
|
function clamp(value, min, max) {
|
|
190
300
|
return value < min ? min : value > max ? max : value;
|
|
191
301
|
}
|
|
302
|
+
//the signed turn from `from` to `to`, in (-pi, pi], so easing always takes the shorter way
|
|
303
|
+
//around rather than winding the long way when the two angles straddle a full turn
|
|
304
|
+
function angleDiff(from, to) {
|
|
305
|
+
const twoPi = Math.PI * 2;
|
|
306
|
+
let diff = (to - from) % twoPi;
|
|
307
|
+
if (diff > Math.PI)
|
|
308
|
+
diff -= twoPi;
|
|
309
|
+
if (diff < -Math.PI)
|
|
310
|
+
diff += twoPi;
|
|
311
|
+
return diff;
|
|
312
|
+
}
|
|
192
313
|
/**
|
|
193
314
|
* The nearest zoom to `zoom` at which `tileSize * zoom` is a whole number of screen pixels -
|
|
194
315
|
* the pure math behind `CameraOptions.pixelPerfectTileSize`, exported so a game can snap a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Camera.js","sourceRoot":"","sources":["../../../src/two-d/render/Camera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAwDrD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,MAAM;IAiClB,YAAY,OAAO,GAAkB,EAAE;QAhCvC,4CAA4C;QACnC,UAAK,GAAG,IAAI,SAAS,EAAE,CAAC;QAEjC,yCAAyC;QACzC,MAAC,GAAG,CAAC,CAAC;QACN,MAAC,GAAG,CAAC,CAAC;QAME,cAAS,GAAG,CAAC,CAAC;QACd,eAAU,GAAG,CAAC,CAAC;QACvB,qFAAqF;QACrF,uFAAuF;QAC/E,YAAO,GAAG,CAAC,CAAC;QACZ,YAAO,GAAG,CAAC,CAAC;QAEZ,iBAAY,GAAoC,IAAI,CAAC;QAC7D,kFAAkF;QAClF,kEAAkE;QAC1D,oBAAe,GAAG,CAAC,CAAC;QAEpB,mBAAc,GAAG,CAAC,CAAC;QACnB,mBAAc,GAAG,CAAC,CAAC;QACnB,kBAAa,GAAG,CAAC,CAAC;QAClB,WAAM,GAAG,CA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C/B,IAAI,IAAI,GAAG,IAAI,CAAC,EAAE;QAAE,IAAI,IAAI,KAAK,CAAC;IAClC,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE;QAAE,IAAI,IAAI,KAAK,CAAC;IACnC,OAAO,IAAI,CAAC;AACb,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,QAAgB;IACtD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC;IACxD,OAAO,MAAM,GAAG,QAAQ,CAAC;AAC1B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,OAAO,GAAkB,EAAE;IACvD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC;IAC1B,iFAAiF;IACjF,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5C,OAAO,MAAM,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { AnimatedSprite } from './AnimatedSprite.ts';
|
|
2
|
+
import type { AnimationFrameInput, AnimationOptions } from './AnimatedSprite.ts';
|
|
3
|
+
/** the name the halo's own cycle is registered under, so a caller can `has`/`play` it knowingly */
|
|
4
|
+
export declare const HALO_ANIMATION = "halo";
|
|
5
|
+
export interface HaloOptions {
|
|
6
|
+
/** the halo's frames, as `Animation` takes them: textures, or `{ texture, duration, offsetX, offsetY }` */
|
|
7
|
+
readonly frames: readonly AnimationFrameInput[];
|
|
8
|
+
/** the cycle's timing, `fps`/`loop`/`startTime` */
|
|
9
|
+
readonly animation?: AnimationOptions;
|
|
10
|
+
/** where the halo sits relative to its target, in pixels: Wesnoth's `[halo] x`/`y` */
|
|
11
|
+
readonly offsetX?: number;
|
|
12
|
+
readonly offsetY?: number;
|
|
13
|
+
/**
|
|
14
|
+
* How the halo is composited. Additive by default, which is what a glow wants and what Wesnoth's
|
|
15
|
+
* `[halo] blend_mode=add` asks for; `'normal'` is there for a halo that is only an overlay.
|
|
16
|
+
*
|
|
17
|
+
* The list stops at what a halo is for rather than at every mode the renderer has: a caller who
|
|
18
|
+
* wants another one sets the inherited `blendMode` property directly.
|
|
19
|
+
*/
|
|
20
|
+
readonly blendMode?: 'add' | 'normal' | 'multiply' | 'screen';
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The glow around a unit, an aura, a shrine's light: an animated sprite that follows a target and is
|
|
24
|
+
* drawn additively.
|
|
25
|
+
*
|
|
26
|
+
* It is an `AnimatedSprite`, so frames may carry their own durations and offsets, and `update(dt)`
|
|
27
|
+
* advances it exactly as it advances any other animation. Two things are its own: `follow`, which
|
|
28
|
+
* applies the halo's offset once rather than in every game that draws one, and the blend mode.
|
|
29
|
+
*
|
|
30
|
+
* Z-order is the caller's, and that is not an oversight: a halo that should sit *behind* its unit is
|
|
31
|
+
* added before it (`container.addChild(glow, glow2, unit)`), and one that should sit in front is
|
|
32
|
+
* added after. A framework that guessed would be wrong half the time, and a game that wants the
|
|
33
|
+
* glow to be part of the unit's own rotation adds it to the unit instead.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* import { Halo, HALO_ANIMATION, SpriteSheet } from '@datamoc/mw_games/two-d/render';
|
|
38
|
+
*
|
|
39
|
+
* declare const sheet: SpriteSheet;
|
|
40
|
+
* declare const unit: { x: number; y: number };
|
|
41
|
+
*
|
|
42
|
+
* const glow = new Halo({ frames: sheet.range(20, 22), animation: { fps: 6 }, offsetY: -6 });
|
|
43
|
+
* glow.follow(unit.x, unit.y);
|
|
44
|
+
* glow.update(1 / 60);
|
|
45
|
+
* console.log(glow.playing === HALO_ANIMATION); // true - a halo is always playing its own cycle
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare class Halo extends AnimatedSprite {
|
|
49
|
+
private readonly offsetX;
|
|
50
|
+
private readonly offsetY;
|
|
51
|
+
constructor(options: HaloOptions);
|
|
52
|
+
/**
|
|
53
|
+
* Puts the halo where its target stands, with whatever offset it was built with. Call it whenever
|
|
54
|
+
* the target moves, or every frame - the halo's own position is never touched by its animation.
|
|
55
|
+
*/
|
|
56
|
+
follow(x: number, y: number): this;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=Halo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Halo.d.ts","sourceRoot":"","sources":["../../../src/two-d/render/Halo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEjF,mGAAmG;AACnG,eAAO,MAAM,cAAc,SAAS,CAAC;AAErC,MAAM,WAAW,WAAW;IAC3B,2GAA2G;IAC3G,QAAQ,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAEhD,mDAAmD;IACnD,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAEtC,sFAAsF;IACtF,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC;CAC9D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,IAAK,SAAQ,cAAc;IACvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC,YAAY,OAAO,EAAE,WAAW,EAO/B;IAED;;;OAGG;IACH,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAGjC;CACD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { AnimatedSprite } from './AnimatedSprite.js';
|
|
2
|
+
/** the name the halo's own cycle is registered under, so a caller can `has`/`play` it knowingly */
|
|
3
|
+
export const HALO_ANIMATION = 'halo';
|
|
4
|
+
/**
|
|
5
|
+
* The glow around a unit, an aura, a shrine's light: an animated sprite that follows a target and is
|
|
6
|
+
* drawn additively.
|
|
7
|
+
*
|
|
8
|
+
* It is an `AnimatedSprite`, so frames may carry their own durations and offsets, and `update(dt)`
|
|
9
|
+
* advances it exactly as it advances any other animation. Two things are its own: `follow`, which
|
|
10
|
+
* applies the halo's offset once rather than in every game that draws one, and the blend mode.
|
|
11
|
+
*
|
|
12
|
+
* Z-order is the caller's, and that is not an oversight: a halo that should sit *behind* its unit is
|
|
13
|
+
* added before it (`container.addChild(glow, glow2, unit)`), and one that should sit in front is
|
|
14
|
+
* added after. A framework that guessed would be wrong half the time, and a game that wants the
|
|
15
|
+
* glow to be part of the unit's own rotation adds it to the unit instead.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { Halo, HALO_ANIMATION, SpriteSheet } from '@datamoc/mw_games/two-d/render';
|
|
20
|
+
*
|
|
21
|
+
* declare const sheet: SpriteSheet;
|
|
22
|
+
* declare const unit: { x: number; y: number };
|
|
23
|
+
*
|
|
24
|
+
* const glow = new Halo({ frames: sheet.range(20, 22), animation: { fps: 6 }, offsetY: -6 });
|
|
25
|
+
* glow.follow(unit.x, unit.y);
|
|
26
|
+
* glow.update(1 / 60);
|
|
27
|
+
* console.log(glow.playing === HALO_ANIMATION); // true - a halo is always playing its own cycle
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export class Halo extends AnimatedSprite {
|
|
31
|
+
constructor(options) {
|
|
32
|
+
super();
|
|
33
|
+
this.offsetX = options.offsetX ?? 0;
|
|
34
|
+
this.offsetY = options.offsetY ?? 0;
|
|
35
|
+
this.blendMode = options.blendMode ?? 'add';
|
|
36
|
+
this.add(HALO_ANIMATION, options.frames, options.animation);
|
|
37
|
+
this.play(HALO_ANIMATION);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Puts the halo where its target stands, with whatever offset it was built with. Call it whenever
|
|
41
|
+
* the target moves, or every frame - the halo's own position is never touched by its animation.
|
|
42
|
+
*/
|
|
43
|
+
follow(x, y) {
|
|
44
|
+
this.position.set(x + this.offsetX, y + this.offsetY);
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=Halo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Halo.js","sourceRoot":"","sources":["../../../src/two-d/render/Halo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,mGAAmG;AACnG,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC;AAuBrC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,IAAK,SAAQ,cAAc;IAIvC,YAAY,OAAoB;QAC/B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;QAC5C,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QAC5D,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,CAAS,EAAE,CAAS;QAC1B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;IACb,CAAC;CACD"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ColorMatrixFilter, Sprite, Texture } from 'pixi.js';
|
|
2
|
+
import type { PaletteMapping, RecolorProbe } from './PaletteRemap.ts';
|
|
3
|
+
import type { Texture2D } from './Types2D.ts';
|
|
2
4
|
/** A parsed `image~MOD(args)` path, usable by any MWG game content format. */
|
|
3
5
|
export interface ImageModifier {
|
|
4
6
|
readonly name: string;
|
|
@@ -35,6 +37,52 @@ export declare function imageModifier(path: ParsedImagePath, name: string): Imag
|
|
|
35
37
|
* ```
|
|
36
38
|
*/
|
|
37
39
|
export declare function colorShiftMatrix(red: number, green: number, blue: number): ColorMatrixFilter['matrix'];
|
|
40
|
+
/**
|
|
41
|
+
* Build the matrix for `~R`/`~G`/`~B(percent)`: scales one or more channels by a percentage
|
|
42
|
+
* (100 = unchanged), leaving any channel not passed at 100%.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* import { channelScaleMatrix } from '@datamoc/mw_games/two-d/render';
|
|
47
|
+
* const matrix = channelScaleMatrix({ red: 150 }); // ~R(150), a 50% brighter red channel
|
|
48
|
+
* console.log(matrix[0]); // 1.5
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function channelScaleMatrix(scale: {
|
|
52
|
+
red?: number;
|
|
53
|
+
green?: number;
|
|
54
|
+
blue?: number;
|
|
55
|
+
}): ColorMatrixFilter['matrix'];
|
|
56
|
+
/**
|
|
57
|
+
* A live, per-frame colour-matrix approximation of a blend towards `color` (0xRRGGBB) by
|
|
58
|
+
* `ratio`, the same shape `TintedSprite.lerpTint` gives an additive-capable sprite, expressed
|
|
59
|
+
* here as a plain matrix so a bare Pixi `Sprite` can use it too. This is *not* what
|
|
60
|
+
* `applyTextureModifiers` uses for `~BLEND` itself (that bakes an exact per-pixel blend once,
|
|
61
|
+
* via `blendPixels`, rather than attaching a runtime filter) - kept as its own export for a
|
|
62
|
+
* game that wants a cheap, adjustable-at-runtime approximation instead of a baked texture, the
|
|
63
|
+
* tradeoff `~CS`'s `colorShiftMatrix` already makes for an additive shift.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* import { blendMatrix } from '@datamoc/mw_games/two-d/render';
|
|
68
|
+
* const matrix = blendMatrix(0xff0000, 0.5); // half-way to red
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export declare function blendMatrix(color: number, ratio: number): ColorMatrixFilter['matrix'];
|
|
72
|
+
/** One `~CHAN` output-channel source: a named input channel, or a constant 0/1. */
|
|
73
|
+
export type ChannelSource = 'R' | 'G' | 'B' | 'A' | '0' | '1';
|
|
74
|
+
/**
|
|
75
|
+
* Build the matrix for `~CHAN(r,g,b,a)`: each output channel is fed by whichever named input
|
|
76
|
+
* channel (or constant black/white) is given for it, missing trailing entries left as the
|
|
77
|
+
* output channel's own identity source (`R,G,B,A`).
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* import { channelSwapMatrix } from '@datamoc/mw_games/two-d/render';
|
|
82
|
+
* const matrix = channelSwapMatrix(['B', 'G', 'R']); // swap the red and blue channels
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare function channelSwapMatrix(sources: readonly ChannelSource[]): ColorMatrixFilter['matrix'];
|
|
38
86
|
/** Apply the renderer-neutral subset supported by the Pixi backend. */
|
|
39
87
|
/**
|
|
40
88
|
* @example
|
|
@@ -55,4 +103,130 @@ export declare function applyImageModifiers(sprite: Sprite, parsed: ParsedImageP
|
|
|
55
103
|
* ```
|
|
56
104
|
*/
|
|
57
105
|
export declare function croppedTexture(texture: Texture, parsed: ParsedImagePath): Texture;
|
|
106
|
+
/**
|
|
107
|
+
* `~RC(src>dst,src>dst,...)`'s pairs, each side hex (`#c0ffee`, `c0ffee`) or, when `resolve` is
|
|
108
|
+
* given, a named colour (`~RC(magenta>red)`) it resolves. A pair whose either side is neither
|
|
109
|
+
* hex nor resolvable is dropped rather than aborting the whole list.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```ts
|
|
113
|
+
* import { parseColorPairs, parseImagePath, imageModifier } from '@datamoc/mw_games/two-d/render';
|
|
114
|
+
*
|
|
115
|
+
* const rc = imageModifier(parseImagePath('unit.png~RC(magenta>ff0000)'), 'RC')!;
|
|
116
|
+
* const mapping = parseColorPairs(rc.args, (name) => (name === 'magenta' ? 0xff00ff : undefined));
|
|
117
|
+
* console.log(mapping); // { from: [0xff00ff], to: [0xff0000] }
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export declare function parseColorPairs(args: readonly string[], resolve?: (name: string) => number | undefined): PaletteMapping;
|
|
121
|
+
/**
|
|
122
|
+
* `~PAL(a,b,c>x,y,z)`'s two comma-separated colour lists, one per side of a single `>`. The
|
|
123
|
+
* modifier's own args have already been comma-split by `parseImagePath` before this runs (the
|
|
124
|
+
* same naive split every modifier's argument list goes through), so `a,b,c>x,y,z` arrives as
|
|
125
|
+
* the four separate tokens `['a', 'b', 'c>x', 'y', 'z']` - rejoining them with `,` recovers the
|
|
126
|
+
* original text before this does its own split on `>` and then `,`, rather than assuming the
|
|
127
|
+
* list boundary landed on an argument boundary the way a naive `args[0]`/`args[1]` read would.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* import { parsePaletteLists, parseImagePath, imageModifier } from '@datamoc/mw_games/two-d/render';
|
|
132
|
+
*
|
|
133
|
+
* const pal = imageModifier(parseImagePath('unit.png~PAL(ff0000,00ff00>0000ff,ffff00)'), 'PAL')!;
|
|
134
|
+
* console.log(parsePaletteLists(pal.args)); // { from: [0xff0000, 0x00ff00], to: [0x0000ff, 0xffff00] }
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
export declare function parsePaletteLists(args: readonly string[], resolve?: (name: string) => number | undefined): PaletteMapping;
|
|
138
|
+
/**
|
|
139
|
+
* Resolves a nested `~BLIT`/`~MASK` image path to a texture already loaded by the caller, and
|
|
140
|
+
* (`~RC`/`~PAL`) a named colour that is not hex. `resolveTexture` receives the raw argument text
|
|
141
|
+
* exactly as written, nested modifiers included (`unit.png~RC(magenta>red)`, not stripped down
|
|
142
|
+
* to `unit.png`) - parsing and applying those is the caller's own recursive call into
|
|
143
|
+
* `parseImagePath`/`applyImageModifiers`/`applyTextureModifiers`, not something this function
|
|
144
|
+
* does on the caller's behalf, since a caller with no sibling asset resolver has nothing to
|
|
145
|
+
* recurse into anyway.
|
|
146
|
+
*/
|
|
147
|
+
export interface ImageTextureProbe extends RecolorProbe {
|
|
148
|
+
resolveTexture?(pathWithModifiers: string): Texture2D | undefined;
|
|
149
|
+
resolveColor?(name: string): number | undefined;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Applies the modifiers that need real pixel access or a sibling texture rather than a sprite
|
|
153
|
+
* property or a Pixi filter: `~RC` (exact palette swap, `src>dst` hex or named-colour pairs -
|
|
154
|
+
* see `resolveColor`/`parseColorPairs`), `~PAL` (the same swap from two comma-separated colour
|
|
155
|
+
* lists either side of one `>` - see `parsePaletteLists`), `~BLIT` (composite another image on
|
|
156
|
+
* top at an offset), `~MASK` (take alpha from another image at an offset, keeping this image's
|
|
157
|
+
* own colour), `~BLEND` (an exact per-pixel lerp towards a colour, via `blendPixels`) and
|
|
158
|
+
* `~ROTATE` (rotates the source pixels themselves and expands the surface, via `rotatePixels` -
|
|
159
|
+
* this is why `~ROTATE` lives here rather than as a sprite transform: it has to be right for
|
|
160
|
+
* terrain and anything else that must keep tiling after the rotation). `~BLIT`/`~MASK` need
|
|
161
|
+
* `probe.resolveTexture` to find the sibling image; without it they are skipped rather than
|
|
162
|
+
* treated as an error, since a caller that only wants `~RC`/`~PAL` has no sibling image to
|
|
163
|
+
* resolve. `resolveTexture` receives the argument exactly as written, nested modifiers included
|
|
164
|
+
* (`~BLIT(claws.png~FL(horiz),4,4)` calls it with `'claws.png~FL(horiz)'`, not `'claws.png'`) -
|
|
165
|
+
* parsing and applying those recursively is the caller's own job, this function composites
|
|
166
|
+
* whatever texture it is handed back.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* import { Texture } from 'pixi.js';
|
|
171
|
+
* import { applyTextureModifiers, parseImagePath } from '@datamoc/mw_games/two-d/render';
|
|
172
|
+
* const recolored = applyTextureModifiers(Texture.EMPTY, parseImagePath('unit.png~RC(ff00ff>ff0000)'));
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
export declare function applyTextureModifiers(texture: Texture, parsed: ParsedImagePath, probe?: ImageTextureProbe): Texture;
|
|
176
|
+
/**
|
|
177
|
+
* The renderer-free core of `~MASK`: `base`'s alpha channel is multiplied by `mask`'s alpha at
|
|
178
|
+
* the given offset (a pixel the mask does not cover keeps zero alpha), `base`'s own colour
|
|
179
|
+
* left untouched. Exported so the masking logic is testable without a canvas.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```ts
|
|
183
|
+
* import { maskPixels } from '@datamoc/mw_games/two-d/render';
|
|
184
|
+
* const base = new Uint8ClampedArray([10, 20, 30, 255]); // one opaque pixel
|
|
185
|
+
* const mask = new Uint8ClampedArray([0, 0, 0, 128]); // half-alpha mask, same 1x1 size
|
|
186
|
+
* const out = maskPixels(base, 1, 1, mask, 1, 1, 0, 0);
|
|
187
|
+
* console.log([...out]); // [10, 20, 30, 128]
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
export declare function maskPixels(base: Uint8ClampedArray, baseWidth: number, baseHeight: number, mask: Uint8ClampedArray, maskWidth: number, maskHeight: number, offsetX: number, offsetY: number): Uint8ClampedArray;
|
|
191
|
+
/**
|
|
192
|
+
* The renderer-free core of `~BLEND`: every pixel's RGB is lerped `ratio` of the way towards
|
|
193
|
+
* `color` (0xRRGGBB), an exact per-pixel blend rather than `blendMatrix`'s runtime
|
|
194
|
+
* approximation - this is what `applyTextureModifiers` bakes into the texture once. Alpha is
|
|
195
|
+
* untouched; a fully transparent pixel is skipped entirely, matching `remapPixels`.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```ts
|
|
199
|
+
* import { blendPixels } from '@datamoc/mw_games/two-d/render';
|
|
200
|
+
*
|
|
201
|
+
* const pixels = new Uint8ClampedArray([0, 0, 0, 255]); // one opaque black pixel
|
|
202
|
+
* const out = blendPixels(pixels, 0xff0000, 0.5);
|
|
203
|
+
* console.log([...out]); // [128, 0, 0, 255] - half-way to red
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
export declare function blendPixels(pixels: Uint8ClampedArray, color: number, ratio: number): Uint8ClampedArray;
|
|
207
|
+
export interface RotatedPixels {
|
|
208
|
+
readonly data: Uint8ClampedArray;
|
|
209
|
+
readonly width: number;
|
|
210
|
+
readonly height: number;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* The renderer-free core of `~ROTATE`: rotates the source pixels themselves by `degrees`
|
|
214
|
+
* (clockwise) around their centre and expands the surface to fit the rotated bounds, rather
|
|
215
|
+
* than turning a sprite's own transform - `applyImageModifiers`'s `sprite.rotation` leaves the
|
|
216
|
+
* art unrotated and does not grow the surface, which is wrong for terrain and anything else
|
|
217
|
+
* that has to keep tiling after the rotation. A destination pixel outside the source once
|
|
218
|
+
* rotated back is fully transparent. Sampling is nearest-neighbour, so an exact multiple of 90
|
|
219
|
+
* degrees round-trips pixel-for-pixel; other angles show the aliasing any nearest-neighbour
|
|
220
|
+
* rotation does.
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```ts
|
|
224
|
+
* import { rotatePixels } from '@datamoc/mw_games/two-d/render';
|
|
225
|
+
*
|
|
226
|
+
* const pixels = new Uint8ClampedArray([255, 0, 0, 255, 0, 255, 0, 255]); // 2x1: red, green
|
|
227
|
+
* const rotated = rotatePixels(pixels, 2, 1, 90);
|
|
228
|
+
* console.log(rotated.width, rotated.height); // 1, 2 - the surface expanded to fit
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
export declare function rotatePixels(pixels: Uint8ClampedArray, width: number, height: number, degrees: number): RotatedPixels;
|
|
58
232
|
//# sourceMappingURL=ImageModifiers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageModifiers.d.ts","sourceRoot":"","sources":["../../../src/two-d/render/ImageModifiers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAa,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAExE,8EAA8E;AAC9E,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,SAAS,aAAa,EAAE,CAAC;CAC7C;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,CAyB7D;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAE5F;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAuBtG;AAED,uEAAuE;AACvE;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAA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