@hi-ashleyj/llama 0.1.0 → 0.2.1
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/Drawables.d.ts +1 -0
- package/Drawables.js +1 -0
- package/README.md +6 -0
- package/components/Drawables/Arc.svelte +23 -0
- package/components/Drawables/Arc.svelte.d.ts +19 -0
- package/components/Drawables/Circle.svelte +19 -0
- package/components/Drawables/Circle.svelte.d.ts +17 -0
- package/components/Drawables/Rectangle.svelte +17 -0
- package/components/Drawables/Rectangle.svelte.d.ts +17 -0
- package/components/Drawables/index.d.ts +3 -0
- package/components/Drawables/index.js +3 -0
- package/components/Game.svelte +75 -0
- package/components/Game.svelte.d.ts +27 -0
- package/components/GameObject.svelte +24 -0
- package/components/GameObject.svelte.d.ts +25 -0
- package/components/Layer.svelte +33 -0
- package/components/Layer.svelte.d.ts +18 -0
- package/components/motions.d.ts +25 -0
- package/components/motions.js +39 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/package.json +26 -15
- package/setup.d.ts +9 -0
- package/setup.js +42 -0
- package/types/contexts.d.ts +22 -0
- package/types/index.d.ts +1 -0
- package/.parcel-cache/793d22ee560c2618 +0 -0
- package/.parcel-cache/b6694c1eefd2b32c +0 -0
- package/.parcel-cache/c0e87891cd14f32b.txt +0 -4517
- package/.parcel-cache/cbf39635cd1b2434 +0 -0
- package/.parcel-cache/data.mdb +0 -0
- package/.parcel-cache/ffdc629ccf572e1f +0 -0
- package/.parcel-cache/lock.mdb +0 -0
- package/dist/main.d.ts +0 -206
- package/dist/main.d.ts.map +0 -1
- package/dist/main.js +0 -543
- package/dist/main.js.map +0 -1
package/dist/main.js
DELETED
|
@@ -1,543 +0,0 @@
|
|
|
1
|
-
class $edb0ad70e86925e1$export$bd0bf19f25da8474 {
|
|
2
|
-
static events = [];
|
|
3
|
-
static lasts = {};
|
|
4
|
-
static pressed = {};
|
|
5
|
-
static mouseLocation = {};
|
|
6
|
-
static on(action, target, callback) {
|
|
7
|
-
$edb0ad70e86925e1$export$bd0bf19f25da8474.events.push({
|
|
8
|
-
action: action,
|
|
9
|
-
target: target,
|
|
10
|
-
callback: callback
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
static fire(action, target, data) {
|
|
14
|
-
$edb0ad70e86925e1$export$bd0bf19f25da8474.events.forEach((event)=>{
|
|
15
|
-
if (event.action && event.action !== action) return;
|
|
16
|
-
if (event.target && event.target !== target) return;
|
|
17
|
-
event.callback(action, target, data ? data : null);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
static isPressed(code) {
|
|
21
|
-
return $edb0ad70e86925e1$export$bd0bf19f25da8474.pressed[code];
|
|
22
|
-
}
|
|
23
|
-
static handleKeyboard(e) {
|
|
24
|
-
let target = "key_" + e.key.toLowerCase();
|
|
25
|
-
switch(e.type){
|
|
26
|
-
case "keydown":
|
|
27
|
-
if ($edb0ad70e86925e1$export$bd0bf19f25da8474.pressed[target]) return;
|
|
28
|
-
$edb0ad70e86925e1$export$bd0bf19f25da8474.pressed[target] = true;
|
|
29
|
-
$edb0ad70e86925e1$export$bd0bf19f25da8474.lasts[target] = e.timeStamp;
|
|
30
|
-
return $edb0ad70e86925e1$export$bd0bf19f25da8474.fire("press", target);
|
|
31
|
-
case "keyup":
|
|
32
|
-
{
|
|
33
|
-
if (!$edb0ad70e86925e1$export$bd0bf19f25da8474.pressed[target]) return;
|
|
34
|
-
$edb0ad70e86925e1$export$bd0bf19f25da8474.pressed[target] = false;
|
|
35
|
-
$edb0ad70e86925e1$export$bd0bf19f25da8474.lasts[target] = e.timeStamp;
|
|
36
|
-
$edb0ad70e86925e1$export$bd0bf19f25da8474.fire("release", target);
|
|
37
|
-
let diff = e.timeStamp - $edb0ad70e86925e1$export$bd0bf19f25da8474.lasts[target];
|
|
38
|
-
$edb0ad70e86925e1$export$bd0bf19f25da8474.fire("hold", target, {
|
|
39
|
-
diff: diff
|
|
40
|
-
});
|
|
41
|
-
if (diff <= 150) return $edb0ad70e86925e1$export$bd0bf19f25da8474.fire("click", target);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
static handleMouse(e) {
|
|
46
|
-
let target = "mouse_" + (e.button ? [
|
|
47
|
-
"left",
|
|
48
|
-
"middle",
|
|
49
|
-
"right",
|
|
50
|
-
"back",
|
|
51
|
-
"forward"
|
|
52
|
-
][e.button] : "moose");
|
|
53
|
-
if (e.clientX && e.clientY) {
|
|
54
|
-
if ($edb0ad70e86925e1$export$bd0bf19f25da8474.mouseLocation.x && $edb0ad70e86925e1$export$bd0bf19f25da8474.mouseLocation.y) {
|
|
55
|
-
let deltaX = e.clientX - $edb0ad70e86925e1$export$bd0bf19f25da8474.mouseLocation.x;
|
|
56
|
-
let deltaY = e.clientY - $edb0ad70e86925e1$export$bd0bf19f25da8474.mouseLocation.y;
|
|
57
|
-
$edb0ad70e86925e1$export$bd0bf19f25da8474.fire("move", "mouse_location", {
|
|
58
|
-
x: e.clientX,
|
|
59
|
-
y: e.clientY,
|
|
60
|
-
deltaX: deltaX,
|
|
61
|
-
deltaY: deltaY
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
$edb0ad70e86925e1$export$bd0bf19f25da8474.mouseLocation.x = e.clientX;
|
|
65
|
-
$edb0ad70e86925e1$export$bd0bf19f25da8474.mouseLocation.y = e.clientY;
|
|
66
|
-
}
|
|
67
|
-
switch(e.type){
|
|
68
|
-
case "wheel":
|
|
69
|
-
{
|
|
70
|
-
let direction = "";
|
|
71
|
-
if (e.deltaY < 0) direction += "N";
|
|
72
|
-
else if (e.deltaY > 0) direction += "S";
|
|
73
|
-
if (e.deltaX < 0) direction += "W";
|
|
74
|
-
else if (e.deltaX > 0) direction += "E";
|
|
75
|
-
return $edb0ad70e86925e1$export$bd0bf19f25da8474.fire("move", "mouse_wheel", {
|
|
76
|
-
direction: direction,
|
|
77
|
-
deltaX: e.deltaX,
|
|
78
|
-
deltaY: e.deltaY
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
case "mousedown":
|
|
82
|
-
if ($edb0ad70e86925e1$export$bd0bf19f25da8474.pressed[target]) return;
|
|
83
|
-
$edb0ad70e86925e1$export$bd0bf19f25da8474.pressed[target] = true;
|
|
84
|
-
$edb0ad70e86925e1$export$bd0bf19f25da8474.lasts[target] = e.timeStamp;
|
|
85
|
-
return $edb0ad70e86925e1$export$bd0bf19f25da8474.fire("press", target);
|
|
86
|
-
case "mouseup":
|
|
87
|
-
{
|
|
88
|
-
if (!$edb0ad70e86925e1$export$bd0bf19f25da8474.pressed[target]) return;
|
|
89
|
-
$edb0ad70e86925e1$export$bd0bf19f25da8474.pressed[target] = false;
|
|
90
|
-
$edb0ad70e86925e1$export$bd0bf19f25da8474.lasts[target] = e.timeStamp;
|
|
91
|
-
$edb0ad70e86925e1$export$bd0bf19f25da8474.fire("release", target);
|
|
92
|
-
let diff = e.timeStamp - $edb0ad70e86925e1$export$bd0bf19f25da8474.lasts[target];
|
|
93
|
-
$edb0ad70e86925e1$export$bd0bf19f25da8474.fire("hold", target, {
|
|
94
|
-
diff: diff
|
|
95
|
-
});
|
|
96
|
-
if (diff <= 150) return $edb0ad70e86925e1$export$bd0bf19f25da8474.fire("click", target);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
static setup() {
|
|
101
|
-
document.addEventListener("mousedown", $edb0ad70e86925e1$export$bd0bf19f25da8474.handleMouse, false);
|
|
102
|
-
document.addEventListener("mouseup", $edb0ad70e86925e1$export$bd0bf19f25da8474.handleMouse, false);
|
|
103
|
-
document.addEventListener("mousemove", $edb0ad70e86925e1$export$bd0bf19f25da8474.handleMouse, false);
|
|
104
|
-
document.addEventListener("wheel", $edb0ad70e86925e1$export$bd0bf19f25da8474.handleMouse, false);
|
|
105
|
-
document.addEventListener("keydown", $edb0ad70e86925e1$export$bd0bf19f25da8474.handleKeyboard, false);
|
|
106
|
-
document.addEventListener("keyup", $edb0ad70e86925e1$export$bd0bf19f25da8474.handleKeyboard, false);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
class $971351ec61e49235$export$7fc05a3731226b90 {
|
|
112
|
-
static stamp = -1;
|
|
113
|
-
static targets = new Set();
|
|
114
|
-
static tick(stamp) {
|
|
115
|
-
$971351ec61e49235$export$7fc05a3731226b90.stamp = stamp;
|
|
116
|
-
}
|
|
117
|
-
offset = -1;
|
|
118
|
-
constructor(time, steps, count){
|
|
119
|
-
this.time = time;
|
|
120
|
-
this.steps = steps;
|
|
121
|
-
this.count = count ? count : Infinity;
|
|
122
|
-
this.points = Object.keys(steps).map((key)=>parseFloat(key)).sort((a, b)=>a - b);
|
|
123
|
-
$971351ec61e49235$export$7fc05a3731226b90.targets.add(this);
|
|
124
|
-
}
|
|
125
|
-
value() {
|
|
126
|
-
if (this.points.length < 2) return null;
|
|
127
|
-
if (this.offset < 0) this.offset = $971351ec61e49235$export$7fc05a3731226b90.stamp;
|
|
128
|
-
let duration = $971351ec61e49235$export$7fc05a3731226b90.stamp - this.offset;
|
|
129
|
-
if (Math.floor(duration / this.time) >= this.count) return null;
|
|
130
|
-
let factor = duration % this.time / this.time;
|
|
131
|
-
for(let i = 1; i < this.points.length; i++)if (this.points[i] >= factor) {
|
|
132
|
-
let to = this.points[i];
|
|
133
|
-
let from = this.points[i - 1];
|
|
134
|
-
let percent = (factor - from) / (to - from);
|
|
135
|
-
return this.steps[from] + (this.steps[to] - this.steps[from]) * percent;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
class $971351ec61e49235$export$44710f68374d3da8 {
|
|
140
|
-
drawables = [];
|
|
141
|
-
constructor(drawables, duration){
|
|
142
|
-
this.drawables = drawables;
|
|
143
|
-
this.duration = duration;
|
|
144
|
-
this.reset();
|
|
145
|
-
}
|
|
146
|
-
reset() {
|
|
147
|
-
this.timing = new $971351ec61e49235$export$7fc05a3731226b90(this.duration, {
|
|
148
|
-
0: 0,
|
|
149
|
-
1: this.drawables.length
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
draw(layer, x, y, w, h) {
|
|
153
|
-
this.drawables[this.timing.value()].draw(layer, x, y, w, h);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
class $971351ec61e49235$export$e90425c1fce4da58 {
|
|
157
|
-
constructor(drawables, defaultDrawable){
|
|
158
|
-
this.drawables = drawables;
|
|
159
|
-
this.default = defaultDrawable;
|
|
160
|
-
this.use = defaultDrawable;
|
|
161
|
-
}
|
|
162
|
-
draw(layer, x, y, w, h) {
|
|
163
|
-
this.drawables[this.use].draw(layer, x, y, w, h);
|
|
164
|
-
}
|
|
165
|
-
switch(key) {
|
|
166
|
-
if (this.use === key) return;
|
|
167
|
-
this.use = key;
|
|
168
|
-
this.drawables[this.use].reset();
|
|
169
|
-
}
|
|
170
|
-
reset(useDefault = false) {
|
|
171
|
-
if (useDefault) this.use = this.default;
|
|
172
|
-
this.drawables[this.use].reset();
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
const $971351ec61e49235$export$83a1293bbde53b95 = {
|
|
176
|
-
AnimationSequence: $971351ec61e49235$export$44710f68374d3da8,
|
|
177
|
-
AnimationSwitches: $971351ec61e49235$export$e90425c1fce4da58,
|
|
178
|
-
Curves: $971351ec61e49235$export$7fc05a3731226b90
|
|
179
|
-
};
|
|
180
|
-
var $971351ec61e49235$export$2e2bcd8739ae039 = $971351ec61e49235$export$83a1293bbde53b95;
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
class $df9966d71ee61f6e$export$936d0764594b6eb3 {
|
|
186
|
-
static list = new Map();
|
|
187
|
-
targets = new Set();
|
|
188
|
-
constructor(id, options){
|
|
189
|
-
if (!id) throw new Error("Layer id is required");
|
|
190
|
-
if ($df9966d71ee61f6e$export$936d0764594b6eb3.list.has(id)) return $df9966d71ee61f6e$export$936d0764594b6eb3.list.get(id);
|
|
191
|
-
this.id = id;
|
|
192
|
-
this.options = options;
|
|
193
|
-
if (!(0, $8aaa40018df40525$export$985739bfa5723e08).width || !(0, $8aaa40018df40525$export$985739bfa5723e08).height) throw new Error("Game not created yet");
|
|
194
|
-
this.width = (0, $8aaa40018df40525$export$985739bfa5723e08).width;
|
|
195
|
-
this.height = (0, $8aaa40018df40525$export$985739bfa5723e08).height;
|
|
196
|
-
this.canvas = document.createElement("canvas");
|
|
197
|
-
this.canvas.width = (0, $8aaa40018df40525$export$985739bfa5723e08).width;
|
|
198
|
-
this.canvas.height = (0, $8aaa40018df40525$export$985739bfa5723e08).height;
|
|
199
|
-
this.canvas.style.zIndex = options.level.toString();
|
|
200
|
-
this.canvas.className = "llama-game-engine game-canvas";
|
|
201
|
-
this.ctx = this.canvas.getContext("2d");
|
|
202
|
-
this.ctx.imageSmoothingEnabled = false;
|
|
203
|
-
(0, $8aaa40018df40525$export$985739bfa5723e08).pushCanvas(this.canvas);
|
|
204
|
-
$df9966d71ee61f6e$export$936d0764594b6eb3.list.set(id, this);
|
|
205
|
-
}
|
|
206
|
-
assign(...targets) {
|
|
207
|
-
for (const target of targets)this.targets.add(target);
|
|
208
|
-
return this;
|
|
209
|
-
}
|
|
210
|
-
remove(...targets) {
|
|
211
|
-
for (const target of targets)this.targets.delete(target);
|
|
212
|
-
return this;
|
|
213
|
-
}
|
|
214
|
-
purge() {
|
|
215
|
-
this.targets.clear();
|
|
216
|
-
}
|
|
217
|
-
draw() {
|
|
218
|
-
this.ctx.clearRect(0, 0, this.width, this.height);
|
|
219
|
-
for (const target of this.targets)target.draw(this);
|
|
220
|
-
}
|
|
221
|
-
static draw() {
|
|
222
|
-
$df9966d71ee61f6e$export$936d0764594b6eb3.list.forEach((layer)=>{
|
|
223
|
-
layer.draw();
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
static purge() {
|
|
227
|
-
$df9966d71ee61f6e$export$936d0764594b6eb3.list.forEach((layer)=>{
|
|
228
|
-
layer.purge();
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
class $8aaa40018df40525$export$985739bfa5723e08 {
|
|
235
|
-
static timeouts = new Set();
|
|
236
|
-
static last = -1;
|
|
237
|
-
static events = [];
|
|
238
|
-
static makeElements() {
|
|
239
|
-
$8aaa40018df40525$export$985739bfa5723e08.root = document.createElement("div");
|
|
240
|
-
$8aaa40018df40525$export$985739bfa5723e08.root.className = "llama-game-engine game-root";
|
|
241
|
-
$8aaa40018df40525$export$985739bfa5723e08.audioDumpspace = document.createElement("div");
|
|
242
|
-
$8aaa40018df40525$export$985739bfa5723e08.audioDumpspace.className = "llama-game-engine game-audio-dumpspace";
|
|
243
|
-
$8aaa40018df40525$export$985739bfa5723e08.audioDumpspace.hidden = true;
|
|
244
|
-
$8aaa40018df40525$export$985739bfa5723e08.imagesDumpspace = document.createElement("div");
|
|
245
|
-
$8aaa40018df40525$export$985739bfa5723e08.imagesDumpspace.className = "llama-game-engine game-images-dumpspace";
|
|
246
|
-
$8aaa40018df40525$export$985739bfa5723e08.imagesDumpspace.hidden = true;
|
|
247
|
-
document.body.appendChild($8aaa40018df40525$export$985739bfa5723e08.root);
|
|
248
|
-
document.body.appendChild($8aaa40018df40525$export$985739bfa5723e08.audioDumpspace);
|
|
249
|
-
document.body.appendChild($8aaa40018df40525$export$985739bfa5723e08.imagesDumpspace);
|
|
250
|
-
let style = document.createElement("style");
|
|
251
|
-
style.innerHTML = `
|
|
252
|
-
html, body {
|
|
253
|
-
background: black;
|
|
254
|
-
padding: 0;
|
|
255
|
-
margin: 0;
|
|
256
|
-
position: relative;
|
|
257
|
-
overflow: hidden;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
div.llama-game-engine.game-root {
|
|
261
|
-
position: absolute;
|
|
262
|
-
top: 0;
|
|
263
|
-
left: 0;
|
|
264
|
-
width: 100vw;
|
|
265
|
-
height: 100vh;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
canvas.llama-game-engine.game-canvas {
|
|
269
|
-
position: fixed;
|
|
270
|
-
top: 0;
|
|
271
|
-
left: 0;
|
|
272
|
-
width: 100%;
|
|
273
|
-
height: 100%;
|
|
274
|
-
object-fit: contain;
|
|
275
|
-
}
|
|
276
|
-
`;
|
|
277
|
-
document.head.appendChild(style);
|
|
278
|
-
}
|
|
279
|
-
static create(options) {
|
|
280
|
-
$8aaa40018df40525$export$985739bfa5723e08.width = options.width;
|
|
281
|
-
$8aaa40018df40525$export$985739bfa5723e08.height = options.height;
|
|
282
|
-
$8aaa40018df40525$export$985739bfa5723e08.makeElements();
|
|
283
|
-
(0, $edb0ad70e86925e1$export$bd0bf19f25da8474).setup();
|
|
284
|
-
}
|
|
285
|
-
static start() {
|
|
286
|
-
window.requestAnimationFrame($8aaa40018df40525$export$985739bfa5723e08.loop);
|
|
287
|
-
}
|
|
288
|
-
static wait(callback, delay) {
|
|
289
|
-
$8aaa40018df40525$export$985739bfa5723e08.timeouts.add({
|
|
290
|
-
callback: callback,
|
|
291
|
-
delay: delay
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
static on(type, call) {
|
|
295
|
-
$8aaa40018df40525$export$985739bfa5723e08.events.push({
|
|
296
|
-
type: type,
|
|
297
|
-
call: call
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
static fire(type, data) {
|
|
301
|
-
for (let e of $8aaa40018df40525$export$985739bfa5723e08.events)if (e.type == type) e.call(data ? data : null);
|
|
302
|
-
}
|
|
303
|
-
static loop(time) {
|
|
304
|
-
if ($8aaa40018df40525$export$985739bfa5723e08.last < 0) $8aaa40018df40525$export$985739bfa5723e08.last = time;
|
|
305
|
-
let delta = time - $8aaa40018df40525$export$985739bfa5723e08.last;
|
|
306
|
-
if (delta > 1000) {
|
|
307
|
-
window.requestAnimationFrame($8aaa40018df40525$export$985739bfa5723e08.loop);
|
|
308
|
-
return $8aaa40018df40525$export$985739bfa5723e08.last = time;
|
|
309
|
-
}
|
|
310
|
-
(0, $971351ec61e49235$export$2e2bcd8739ae039).Curves.tick(time);
|
|
311
|
-
for (let timeout of $8aaa40018df40525$export$985739bfa5723e08.timeouts){
|
|
312
|
-
if (timeout.start === undefined) {
|
|
313
|
-
timeout.start = time;
|
|
314
|
-
continue;
|
|
315
|
-
}
|
|
316
|
-
if (time >= timeout.start + timeout.delay) {
|
|
317
|
-
timeout.callback(time - (timeout.start + timeout.delay));
|
|
318
|
-
$8aaa40018df40525$export$985739bfa5723e08.timeouts.delete(timeout);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
$8aaa40018df40525$export$985739bfa5723e08.fire("loop", {
|
|
322
|
-
stamp: time,
|
|
323
|
-
delta: delta
|
|
324
|
-
});
|
|
325
|
-
(0, $df9966d71ee61f6e$export$936d0764594b6eb3).draw();
|
|
326
|
-
$8aaa40018df40525$export$985739bfa5723e08.fire("postdraw", {
|
|
327
|
-
stamp: time,
|
|
328
|
-
delta: delta
|
|
329
|
-
});
|
|
330
|
-
window.requestAnimationFrame($8aaa40018df40525$export$985739bfa5723e08.loop);
|
|
331
|
-
$8aaa40018df40525$export$985739bfa5723e08.last = time;
|
|
332
|
-
}
|
|
333
|
-
static pushCanvas(canvas) {
|
|
334
|
-
$8aaa40018df40525$export$985739bfa5723e08.root.append(canvas);
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
class $6e2679f058a662f2$export$434da80b31429dcb {
|
|
340
|
-
constructor(options){
|
|
341
|
-
this.asset = options.asset;
|
|
342
|
-
this.x = options.x ? options.x : 0;
|
|
343
|
-
this.y = options.y ? options.y : 0;
|
|
344
|
-
this.w = options.w ? options.w : 100;
|
|
345
|
-
this.h = options.h ? options.h : 100;
|
|
346
|
-
}
|
|
347
|
-
draw(layer) {
|
|
348
|
-
this.asset.draw(layer, this.x, this.y, this.w, this.h);
|
|
349
|
-
}
|
|
350
|
-
move({ x: x , y: y }) {
|
|
351
|
-
if (typeof x === "number") this.x += x;
|
|
352
|
-
if (typeof y === "number") this.y += y;
|
|
353
|
-
return this;
|
|
354
|
-
}
|
|
355
|
-
scale({ w: w , h: h }) {
|
|
356
|
-
if (typeof w === "number") this.w += w;
|
|
357
|
-
if (typeof h === "number") this.h += h;
|
|
358
|
-
return this;
|
|
359
|
-
}
|
|
360
|
-
position({ x: x , y: y , w: w , h: h }) {
|
|
361
|
-
if (typeof x === "number") this.x = x;
|
|
362
|
-
if (typeof y === "number") this.y = y;
|
|
363
|
-
if (typeof w === "number") this.w = w;
|
|
364
|
-
if (typeof h === "number") this.h = h;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
class $19600059415940a9$export$3e431a229df88919 {
|
|
372
|
-
static locations = new Map();
|
|
373
|
-
static loading = new Set();
|
|
374
|
-
crop = [];
|
|
375
|
-
static getImage(uri) {
|
|
376
|
-
if ($19600059415940a9$export$3e431a229df88919.locations.has(uri)) return $19600059415940a9$export$3e431a229df88919.locations.get(uri);
|
|
377
|
-
let element = document.createElement("img");
|
|
378
|
-
$19600059415940a9$export$3e431a229df88919.locations.set(uri, element);
|
|
379
|
-
$19600059415940a9$export$3e431a229df88919.loading.add(uri);
|
|
380
|
-
element.addEventListener("load", ()=>{
|
|
381
|
-
$19600059415940a9$export$3e431a229df88919.loading.delete(uri);
|
|
382
|
-
});
|
|
383
|
-
element.src = uri;
|
|
384
|
-
$19600059415940a9$export$3e431a229df88919.dumpspace.append(element);
|
|
385
|
-
}
|
|
386
|
-
static setDumpSpace(element) {
|
|
387
|
-
$19600059415940a9$export$3e431a229df88919.dumpspace = element;
|
|
388
|
-
}
|
|
389
|
-
constructor({ image: image , crop: crop }){
|
|
390
|
-
this.location = image;
|
|
391
|
-
this.resource = $19600059415940a9$export$3e431a229df88919.getImage(image);
|
|
392
|
-
if (crop) this.crop = [
|
|
393
|
-
crop.x,
|
|
394
|
-
crop.y,
|
|
395
|
-
crop.width,
|
|
396
|
-
crop.height
|
|
397
|
-
];
|
|
398
|
-
}
|
|
399
|
-
draw(layer, x, y, w, h) {
|
|
400
|
-
if (this.crop.length === 4) return layer.ctx.drawImage(this.resource, ...this.crop, x, y, w, h);
|
|
401
|
-
layer.ctx.drawImage(this.resource, x, y, w, h);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
class $19600059415940a9$export$16ec26812de3ce7a {
|
|
405
|
-
constructor(image, { tiles: tiles , sizeX: sizeX , sizeY: sizeY }){
|
|
406
|
-
this.map = new Array(tiles).map((_ignored, i)=>new $19600059415940a9$export$3e431a229df88919({
|
|
407
|
-
image: image,
|
|
408
|
-
crop: {
|
|
409
|
-
x: i * sizeX,
|
|
410
|
-
y: 0,
|
|
411
|
-
width: sizeX,
|
|
412
|
-
height: sizeY
|
|
413
|
-
}
|
|
414
|
-
}));
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
class $19600059415940a9$export$89abf52a030e56ee {
|
|
418
|
-
static locations = new Map();
|
|
419
|
-
static loading = new Set();
|
|
420
|
-
constructor(name, uri, features){
|
|
421
|
-
this.name = name;
|
|
422
|
-
this.uri = uri;
|
|
423
|
-
this.features = features;
|
|
424
|
-
if ($19600059415940a9$export$89abf52a030e56ee.locations.has(uri)) return;
|
|
425
|
-
if (features) {
|
|
426
|
-
this.features = features;
|
|
427
|
-
this.fontFace = new FontFace(name, "url(" + uri + ")", this.features);
|
|
428
|
-
} else this.fontFace = new FontFace(name, "url(" + uri + ")");
|
|
429
|
-
$19600059415940a9$export$89abf52a030e56ee.loading.add(uri);
|
|
430
|
-
this.fontFace.load().then(()=>{
|
|
431
|
-
$19600059415940a9$export$89abf52a030e56ee.loading.delete(uri);
|
|
432
|
-
document.fonts.add(this.fontFace);
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
class $19600059415940a9$export$250ffa63cdc0d034 {
|
|
437
|
-
constructor({ fill: fill , stroke: stroke }){
|
|
438
|
-
this.fill = fill;
|
|
439
|
-
this.stroke = stroke;
|
|
440
|
-
}
|
|
441
|
-
draw(layer, x, y, w, h) {
|
|
442
|
-
if (this.fill) {
|
|
443
|
-
layer.ctx.fillStyle = this.fill;
|
|
444
|
-
layer.ctx.fill();
|
|
445
|
-
}
|
|
446
|
-
if (this.stroke) {
|
|
447
|
-
layer.ctx.strokeStyle = this.stroke;
|
|
448
|
-
layer.ctx.stroke();
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
static center(x, y, w, h) {
|
|
452
|
-
return [
|
|
453
|
-
x - w / 2,
|
|
454
|
-
y - h / 2,
|
|
455
|
-
w,
|
|
456
|
-
h
|
|
457
|
-
];
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
class $19600059415940a9$export$4617fb02663045ef extends $19600059415940a9$export$250ffa63cdc0d034 {
|
|
461
|
-
constructor({ fill: fill , stroke: stroke }){
|
|
462
|
-
super({
|
|
463
|
-
fill: fill,
|
|
464
|
-
stroke: stroke
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
draw(layer, x, y, w, h) {
|
|
468
|
-
layer.ctx.beginPath();
|
|
469
|
-
layer.ctx.rect(x, y, w, h);
|
|
470
|
-
super.draw(layer, x, y, w, h);
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
class $19600059415940a9$export$c89a927ffc67e6fa extends $19600059415940a9$export$250ffa63cdc0d034 {
|
|
474
|
-
constructor({ fill: fill , stroke: stroke }){
|
|
475
|
-
super({
|
|
476
|
-
fill: fill,
|
|
477
|
-
stroke: stroke
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
draw(layer, x, y, w, h) {
|
|
481
|
-
layer.ctx.beginPath();
|
|
482
|
-
layer.ctx.arc(x + w / 2, y + h / 2, (w + h) / 4, 0, 2 * Math.PI);
|
|
483
|
-
super.draw(layer, x, y, w, h);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
class $19600059415940a9$export$6ef80ffb606dd232 extends $19600059415940a9$export$250ffa63cdc0d034 {
|
|
487
|
-
constructor({ fill: fill , stroke: stroke , angleFrom: angleFrom , angleTo: angleTo }){
|
|
488
|
-
super({
|
|
489
|
-
fill: fill,
|
|
490
|
-
stroke: stroke
|
|
491
|
-
});
|
|
492
|
-
this.angleFrom = (angleFrom - 90) * Math.PI / 180;
|
|
493
|
-
this.angleTo = (angleTo - 90) * Math.PI / 180;
|
|
494
|
-
}
|
|
495
|
-
draw(layer, x, y, w, h) {
|
|
496
|
-
layer.ctx.beginPath();
|
|
497
|
-
layer.ctx.arc(x + w / 2, y + h / 2, (w + h) / 4, this.angleFrom, this.angleTo);
|
|
498
|
-
layer.ctx.lineTo(x + w / 2, y + h / 2);
|
|
499
|
-
super.draw(layer, x, y, w, h);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
class $19600059415940a9$export$5f1af8db9871e1d6 {
|
|
503
|
-
constructor(options){
|
|
504
|
-
this.text = options.text;
|
|
505
|
-
this.size = options.size;
|
|
506
|
-
this.font = options.font;
|
|
507
|
-
this.fill = options.fill ? options.fill : null;
|
|
508
|
-
this.stroke = options.stroke ? options.stroke : null;
|
|
509
|
-
this.style = options.style ? options.style : "";
|
|
510
|
-
this.alignH = options.alignH ? options.alignH : "left";
|
|
511
|
-
this.alignV = options.alignV ? options.alignV : "top";
|
|
512
|
-
}
|
|
513
|
-
draw(layer, x, y, w, h) {
|
|
514
|
-
layer.ctx.textAlign = this.alignH;
|
|
515
|
-
layer.ctx.textBaseline = this.alignV;
|
|
516
|
-
layer.ctx.font = `${this.style ? this.style + " " : ""}${this.size}px ${this.font}`;
|
|
517
|
-
if (this.fill) {
|
|
518
|
-
layer.ctx.fillStyle = this.fill;
|
|
519
|
-
layer.ctx.fillText(this.text, x, y);
|
|
520
|
-
}
|
|
521
|
-
if (this.stroke) {
|
|
522
|
-
layer.ctx.strokeStyle = this.stroke;
|
|
523
|
-
layer.ctx.strokeText(this.text, x, y);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
let $19600059415940a9$export$c413dd039085b182 = {
|
|
528
|
-
Image: $19600059415940a9$export$3e431a229df88919,
|
|
529
|
-
Text: $19600059415940a9$export$5f1af8db9871e1d6,
|
|
530
|
-
Arc: $19600059415940a9$export$6ef80ffb606dd232,
|
|
531
|
-
Circle: $19600059415940a9$export$c89a927ffc67e6fa,
|
|
532
|
-
Rectangle: $19600059415940a9$export$4617fb02663045ef,
|
|
533
|
-
Primitive: $19600059415940a9$export$250ffa63cdc0d034,
|
|
534
|
-
TileMap: $19600059415940a9$export$16ec26812de3ce7a,
|
|
535
|
-
Font: $19600059415940a9$export$89abf52a030e56ee
|
|
536
|
-
};
|
|
537
|
-
var $19600059415940a9$export$2e2bcd8739ae039 = $19600059415940a9$export$c413dd039085b182;
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
export {$edb0ad70e86925e1$export$bd0bf19f25da8474 as Controller, $8aaa40018df40525$export$985739bfa5723e08 as Game, $6e2679f058a662f2$export$434da80b31429dcb as GameObject, $df9966d71ee61f6e$export$936d0764594b6eb3 as Layer, $971351ec61e49235$export$83a1293bbde53b95 as Animate, $19600059415940a9$export$c413dd039085b182 as Asset};
|
|
543
|
-
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"ACEO,MAAM,yCAAU;IACnB,OAAO,MAAM,GAAsB,EAAE,CAAC;IACtC,OAAO,KAAK,GAA8B,EAAE,CAAC;IAC7C,OAAO,OAAO,GAA+B,EAAE,CAAC;IAChD,OAAO,aAAa,GAA+B,EAAE,CAAC;IAEtD,OAAO,EAAE,CAAC,MAAwB,EAAE,MAAc,EAAE,QAA4B,EAAQ;QACpF,yCAAU,CAAC,MAAM,CAAC,IAAI,CAAC;oBAAE,MAAM;oBAAE,MAAM;sBAAE,QAAQ;SAAE,CAAC,CAAC;KACxD;IAED,OAAe,IAAI,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IAAI,CAAC,KAAK,GAAG,GAAG,GAAE,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACrF,IAAI,IAAI,CAAC,IAAI,EAAE;YACX,KAAK,CAAC,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC;YAChC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;SACvC;QACD,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,KAAK,CAAC,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC;YACpC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;SACzC;KACJ;CACJ;AAEM,IAAI,yCAAK,GAAG;WACf,yCAAK;UAAE,yCAAI;SAAE,yCAAG;YAAE,yCAAM;eAAE,yCAAS;eAAE,yCAAS;aAAE,yCAAO;UAAE,yCAAI;CAChE,AAAC;IAEF,wCAAqB,GAAN,yCAAK;;","sources":["src/main.ts","src/controller.ts","src/game.ts","src/animate.ts","src/layer.ts","src/game-object.ts","src/asset.ts"],"sourcesContent":["export { Controller } from \"./controller\";\nexport { Game } from \"./game\";\nexport { GameObject } from \"./game-object\";\nexport { Layer } from \"./layer\";\n\nexport { Animate } from \"./animate\";\nexport { Asset } from \"./asset\";","import { ControllerEvent, ControllerAction, ControllerCallback } from \"./types/controller\";\n\nexport class Controller {\n static events: ControllerEvent[] = [];\n static lasts: { [key: string]: number } = {};\n static pressed: { [key: string]: boolean } = {};\n static mouseLocation: { x?: number, y?: number } = {};\n\n static on(action: ControllerAction, target: string, callback: ControllerCallback): void {\n Controller.events.push({ action, target, callback });\n }\n\n private static fire(action: ControllerAction, target: string, data?: object): void {\n Controller.events.forEach(event => {\n if (event.action && event.action !== action) return;\n if (event.target && event.target !== target) return;\n event.callback(action, target, (data) ? data : null);\n });\n }\n\n static isPressed(code: string): boolean {\n return Controller.pressed[code];\n }\n\n private static handleKeyboard(e) {\n let target = \"key_\" + e.key.toLowerCase();\n switch (e.type) {\n case (\"keydown\"): {\n if (Controller.pressed[target]) return;\n\n Controller.pressed[target] = true;\n Controller.lasts[target] = e.timeStamp;\n return Controller.fire(\"press\", target);\n }\n case (\"keyup\"): {\n if (!Controller.pressed[target]) return;\n\n Controller.pressed[target] = false;\n Controller.lasts[target] = e.timeStamp;\n Controller.fire(\"release\", target);\n\n let diff = e.timeStamp - Controller.lasts[target];\n\n Controller.fire(\"hold\", target, { diff });\n\n if (diff <= 150) {\n return Controller.fire(\"click\", target);\n }\n }\n }\n\n }\n\n private static handleMouse(e) {\n let target = \"mouse_\" + ((e.button) ? [\"left\", \"middle\", \"right\", \"back\", \"forward\"][e.button] : \"moose\");\n if (e.clientX && e.clientY) {\n if (Controller.mouseLocation.x && Controller.mouseLocation.y) {\n let deltaX = e.clientX - Controller.mouseLocation.x;\n let deltaY = e.clientY - Controller.mouseLocation.y;\n\n Controller.fire(\"move\", \"mouse_location\", { x: e.clientX, y: e.clientY, deltaX, deltaY });\n }\n Controller.mouseLocation.x = e.clientX;\n Controller.mouseLocation.y = e.clientY;\n }\n switch (e.type) {\n case (\"wheel\"): {\n let direction = \"\";\n if (e.deltaY < 0) {\n direction += \"N\";\n } else if (e.deltaY > 0) {\n direction += \"S\";\n }\n\n if (e.deltaX < 0) {\n direction += \"W\";\n } else if (e.deltaX > 0) {\n direction += \"E\";\n }\n\n return Controller.fire(\"move\", \"mouse_wheel\", { direction, deltaX: e.deltaX, deltaY: e.deltaY });\n }\n case (\"mousedown\"): {\n if (Controller.pressed[target]) return;\n\n Controller.pressed[target] = true;\n Controller.lasts[target] = e.timeStamp;\n return Controller.fire(\"press\", target);\n }\n case (\"mouseup\"): {\n if (!Controller.pressed[target]) return;\n\n Controller.pressed[target] = false;\n Controller.lasts[target] = e.timeStamp;\n Controller.fire(\"release\", target);\n\n let diff = e.timeStamp - Controller.lasts[target];\n\n Controller.fire(\"hold\", target, { diff });\n\n if (diff <= 150) {\n return Controller.fire(\"click\", target);\n }\n }\n }\n }\n\n static setup(): void {\n document.addEventListener(\"mousedown\", Controller.handleMouse, false);\n document.addEventListener(\"mouseup\", Controller.handleMouse, false);\n document.addEventListener(\"mousemove\", Controller.handleMouse, false);\n document.addEventListener(\"wheel\", Controller.handleMouse, false);\n\n document.addEventListener(\"keydown\", Controller.handleKeyboard, false);\n document.addEventListener(\"keyup\", Controller.handleKeyboard, false);\n }\n}\n","import Animate from \"./animate\";\nimport { Controller } from \"./controller\";\nimport { Layer } from \"./layer\";\n\nexport class Game {\n static width: number;\n static height: number;\n\n static timeouts: Set<{ callback: (after: number) => void, delay: number, start?: number }> = new Set();\n static last: number = -1;\n static events: { type: string, call: Function }[] = [];\n\n private static root: HTMLDivElement;\n private static audioDumpspace: HTMLDivElement;\n private static imagesDumpspace: HTMLDivElement;\n\n private static makeElements() {\n Game.root = document.createElement(\"div\");\n Game.root.className = \"llama-game-engine game-root\";\n\n Game.audioDumpspace = document.createElement(\"div\");\n Game.audioDumpspace.className = \"llama-game-engine game-audio-dumpspace\";\n Game.audioDumpspace.hidden = true;\n\n Game.imagesDumpspace = document.createElement(\"div\");\n Game.imagesDumpspace.className = \"llama-game-engine game-images-dumpspace\";\n Game.imagesDumpspace.hidden = true;\n\n document.body.appendChild(Game.root);\n document.body.appendChild(Game.audioDumpspace);\n document.body.appendChild(Game.imagesDumpspace);\n\n let style = document.createElement(\"style\");\n style.innerHTML = `\n html, body {\n background: black;\n padding: 0;\n margin: 0;\n position: relative;\n overflow: hidden;\n }\n \n div.llama-game-engine.game-root {\n position: absolute;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n }\n \n canvas.llama-game-engine.game-canvas {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n `;\n document.head.appendChild(style);\n }\n\n static create(options: { width: number, height: number }) {\n Game.width = options.width;\n Game.height = options.height;\n Game.makeElements();\n Controller.setup();\n }\n\n static start() {\n window.requestAnimationFrame(Game.loop);\n }\n\n static wait (callback: (after: number) => void, delay: number) {\n Game.timeouts.add({ callback, delay });\n };\n\n static on(type: string, call: Function) {\n Game.events.push({ type, call });\n };\n\n static fire(type, data) {\n for (let e of Game.events) {\n if (e.type == type) {\n e.call((data) ? data : null);\n }\n }\n };\n\n static loop (time: DOMHighResTimeStamp) {\n if (Game.last < 0) Game.last = time;\n\n let delta = (time - Game.last);\n if (delta > 1000) {\n window.requestAnimationFrame(Game.loop);\n return Game.last = time;\n }\n\n Animate.Curves.tick(time);\n\n for (let timeout of Game.timeouts) {\n if (timeout.start === undefined) {\n timeout.start = time;\n continue;\n }\n if (time >= timeout.start + timeout.delay) {\n timeout.callback(time - (timeout.start + timeout.delay));\n Game.timeouts.delete(timeout);\n }\n }\n\n Game.fire(\"loop\", { stamp: time, delta: delta });\n\n Layer.draw();\n\n Game.fire(\"postdraw\", { stamp: time, delta: delta });\n\n window.requestAnimationFrame(Game.loop);\n Game.last = time;\n }\n\n static pushCanvas(canvas: HTMLCanvasElement) {\n Game.root.append(canvas);\n }\n}\n","import { Layer } from \"./layer\";\nimport { Drawable } from \"./types/drawing\";\nimport { AnimatedDrawable } from \"./types/animate\";\n\nexport class Curves {\n static stamp: number = -1;\n static targets: Set<Curves> = new Set();\n\n static tick(stamp: number) {\n Curves.stamp = stamp;\n }\n\n time: number;\n steps: { [percent: number] : number };\n count: number;\n offset: number = -1;\n points: number[];\n\n constructor(time: number, steps: { [percent: number]: number }, count?: number) {\n this.time = time;\n this.steps = steps;\n this.count = (count) ? count : Infinity;\n this.points = Object.keys(steps).map(key => parseFloat(key)).sort((a, b) => a - b);\n\n Curves.targets.add(this);\n }\n\n value(): number | null {\n if (this.points.length < 2) return null;\n if (this.offset < 0) this.offset = Curves.stamp;\n let duration = Curves.stamp - this.offset;\n if (Math.floor(duration / this.time) >= this.count) return null;\n\n let factor = duration % this.time / this.time;\n\n\n for (let i = 1; i < this.points.length; i++) {\n if (this.points[i] >= factor) {\n let to = this.points[i];\n let from = this.points[i - 1];\n let percent = (factor - from) / (to - from);\n return this.steps[from] + (this.steps[to] - this.steps[from]) * percent;\n }\n }\n }\n\n}\n\nexport class AnimationSequence implements AnimatedDrawable {\n private readonly drawables: Drawable[] = [];\n private timing: Curves;\n private readonly duration: number;\n\n constructor(drawables: Drawable[], duration: number) {\n this.drawables = drawables;\n this.duration = duration;\n this.reset();\n }\n\n reset() {\n this.timing = new Curves(this.duration, {\n 0: 0,\n 1: this.drawables.length\n });\n }\n\n draw( layer: Layer, x: number, y: number, w: number, h: number ) {\n this.drawables[this.timing.value()].draw(layer, x, y, w, h);\n }\n\n}\n\nexport class AnimationSwitches implements AnimatedDrawable {\n private readonly drawables: { [key: string]: AnimatedDrawable };\n private use: string;\n private readonly default: string;\n\n constructor(drawables: { [key: string]: AnimatedDrawable }, defaultDrawable: string) {\n this.drawables = drawables;\n this.default = defaultDrawable;\n this.use = defaultDrawable;\n }\n\n draw( layer: Layer, x: number, y: number, w: number, h: number ) {\n this.drawables[this.use].draw(layer, x, y, w, h);\n }\n\n switch(key: string) {\n if (this.use === key) return;\n this.use = key;\n this.drawables[this.use].reset();\n }\n\n reset(useDefault: boolean = false) {\n if (useDefault) this.use = this.default;\n this.drawables[this.use].reset();\n }\n}\n\nexport const Animate = {\n AnimationSequence,\n AnimationSwitches,\n Curves\n};\n\nexport default Animate;","import { GameObject } from \"./game-object\";\nimport { Game } from \"./game\";\n\nexport class Layer {\n static list: Map<string, Layer> = new Map();\n\n private id: string;\n private readonly canvas: HTMLCanvasElement;\n private readonly options: { level: number };\n readonly width: number;\n readonly height: number;\n private targets: Set<GameObject> = new Set();\n\n ctx: CanvasRenderingContext2D;\n\n constructor( id: string, options: { level: number } ) {\n if ( !id ) {\n throw new Error( 'Layer id is required' );\n }\n if (Layer.list.has( id )) {\n return Layer.list.get( id );\n }\n\n this.id = id;\n this.options = options;\n\n if (!Game.width || !Game.height) {\n throw new Error( 'Game not created yet' );\n }\n\n this.width = Game.width;\n this.height = Game.height;\n\n this.canvas = document.createElement( 'canvas' );\n this.canvas.width = Game.width;\n this.canvas.height = Game.height;\n this.canvas.style.zIndex = options.level.toString();\n this.canvas.className = \"llama-game-engine game-canvas\";\n\n this.ctx = this.canvas.getContext( '2d' );\n this.ctx.imageSmoothingEnabled = false;\n\n Game.pushCanvas( this.canvas );\n\n Layer.list.set( id, this );\n }\n\n assign( ...targets: GameObject[] ) {\n for ( const target of targets ) {\n this.targets.add( target );\n }\n return this;\n }\n\n remove( ...targets: GameObject[] ) {\n for ( const target of targets ) {\n this.targets.delete( target );\n }\n return this;\n }\n\n purge() {\n this.targets.clear();\n }\n\n draw() {\n this.ctx.clearRect( 0, 0, this.width, this.height );\n for ( const target of this.targets ) {\n target.draw( this );\n }\n }\n\n\n static draw() {\n Layer.list.forEach( layer => {\n layer.draw();\n } );\n }\n\n static purge() {\n Layer.list.forEach( layer => {\n layer.purge();\n } );\n }\n}\n","import { Layer } from \"./layer\";\nimport { Drawable } from \"./types/drawing\";\n\nexport class GameObject {\n private asset: Drawable;\n private x: number;\n private y: number;\n private w: number;\n private h: number;\n\n constructor( options: { asset: Drawable, x: number, y: number, w: number, h: number } ) {\n this.asset = options.asset;\n this.x = (options.x) ? options.x : 0;\n this.y = (options.y) ? options.y : 0;\n this.w = (options.w) ? options.w : 100;\n this.h = (options.h) ? options.h : 100;\n }\n\n draw( layer: Layer ) {\n this.asset.draw(layer, this.x, this.y, this.w, this.h);\n }\n\n move( { x, y }: { x: number, y: number } ): this {\n if (typeof x === \"number\") this.x += x;\n if (typeof y === \"number\") this.y += y;\n return this;\n }\n\n scale( { w, h }: { w: number, h: number } ): this {\n if (typeof w === \"number\") this.w += w;\n if (typeof h === \"number\") this.h += h;\n return this;\n }\n\n position( { x, y, w, h }: { x: number, y: number, w: number, h: number } ) {\n if (typeof x === \"number\") this.x = x;\n if (typeof y === \"number\") this.y = y;\n if (typeof w === \"number\") this.w = w;\n if (typeof h === \"number\") this.h = h;\n }\n}\n","import { Layer } from \"./layer\";\nimport { Drawable } from \"./types/drawing\";\nimport { TextOptions } from \"./types/asset\";\n\nexport class Image implements Drawable {\n static dumpspace: HTMLDivElement;\n static locations: Map<string, HTMLImageElement> = new Map();\n static loading: Set<string> = new Set();\n\n private location: string;\n private readonly resource: HTMLImageElement;\n private readonly crop: [] | [number, number, number, number] = [];\n\n private static getImage( uri: string ): HTMLImageElement {\n if (Image.locations.has(uri)) {\n return Image.locations.get(uri);\n }\n\n let element = document.createElement(\"img\");\n Image.locations.set(uri, element);\n Image.loading.add(uri);\n\n element.addEventListener(\"load\", () => {\n Image.loading.delete(uri);\n });\n\n element.src = uri;\n Image.dumpspace.append(element);\n }\n\n static setDumpSpace( element: HTMLDivElement ) {\n Image.dumpspace = element;\n }\n\n constructor( { image, crop }: { image: string, crop?: { x: number, y: number, width: number, height: number } } ) {\n this.location = image;\n this.resource = Image.getImage(image);\n\n if (crop) {\n this.crop = [ crop.x, crop.y, crop.width, crop.height ];\n }\n }\n\n draw( layer: Layer, x: number, y: number, w: number, h: number ) {\n if (this.crop.length === 4) {\n return layer.ctx.drawImage(this.resource, ...this.crop, x, y, w, h);\n }\n layer.ctx.drawImage(this.resource, x, y, w, h);\n }\n}\n\nexport class TileMap {\n map: Array<Image>;\n\n constructor(image: string, { tiles, sizeX, sizeY }: { tiles: number, sizeX: number, sizeY: number }) {\n this.map = new Array(tiles).map((_ignored, i) => new Image({ image: image, crop: { x: i * sizeX, y: 0, width: sizeX, height: sizeY } }));\n }\n}\n\nexport class Font {\n static locations: Map<string, boolean> = new Map();\n static loading: Set<string> = new Set<string>();\n\n name: string;\n uri: string;\n features: null;\n fontFace: FontFace;\n\n constructor(name, uri, features) {\n this.name = name;\n this.uri = uri;\n this.features = features;\n\n if (Font.locations.has(uri)) {\n return;\n }\n\n if (features) {\n this.features = features;\n this.fontFace = new FontFace(name, \"url(\" + uri + \")\", this.features);\n } else {\n this.fontFace = new FontFace(name, \"url(\" + uri + \")\");\n }\n\n Font.loading.add(uri);\n this.fontFace.load().then(() => {\n Font.loading.delete(uri);\n document.fonts.add(this.fontFace);\n });\n }\n}\n\nexport class Primitive implements Drawable {\n fill: string;\n stroke: string;\n\n constructor({ fill, stroke } : { fill?: string, stroke?: string } ) {\n this.fill = fill;\n this.stroke = stroke;\n }\n\n draw( layer: Layer, x: number, y: number, w: number, h: number ) {\n if (this.fill) {\n layer.ctx.fillStyle = this.fill;\n layer.ctx.fill();\n }\n if (this.stroke) {\n layer.ctx.strokeStyle = this.stroke;\n layer.ctx.stroke();\n }\n }\n\n static center( x, y, w, h ) {\n return [ x - (w / 2), y - (h / 2), w, h ];\n }\n}\n\nexport class Rectangle extends Primitive {\n constructor({ fill, stroke } : { fill?: string, stroke?: string } ) {\n super({ fill, stroke });\n }\n\n draw( layer: Layer, x: number, y: number, w: number, h: number ) {\n layer.ctx.beginPath();\n layer.ctx.rect(x, y, w, h);\n super.draw(layer, x, y, w, h);\n }\n}\n\nexport class Circle extends Primitive {\n constructor({ fill, stroke } : { fill?: string, stroke?: string } ) {\n super({ fill, stroke });\n }\n\n draw( layer: Layer, x: number, y: number, w: number, h: number ) {\n layer.ctx.beginPath();\n layer.ctx.arc(x + w / 2, y + h / 2, (w + h) / 4, 0, 2 * Math.PI);\n super.draw(layer, x, y, w, h);\n }\n}\n\nexport class Arc extends Primitive {\n angleFrom: number;\n angleTo: number;\n\n constructor({ fill, stroke, angleFrom, angleTo } : { fill?: string, stroke?: string, angleFrom: number, angleTo: number } ) {\n super({ fill, stroke });\n this.angleFrom = ((angleFrom - 90) * Math.PI / 180);\n this.angleTo = ((angleTo - 90) * Math.PI / 180);\n }\n\n draw( layer: Layer, x: number, y: number, w: number, h: number ) {\n layer.ctx.beginPath();\n layer.ctx.arc(x + w / 2, y + h / 2, (w + h) / 4, this.angleFrom, this.angleTo);\n layer.ctx.lineTo(x + w / 2, y + h / 2);\n super.draw(layer, x, y, w, h);\n }\n}\n\n\nexport class Text implements Drawable {\n text: string;\n size: number;\n private readonly font: string;\n fill: string;\n stroke: string;\n style: string;\n private readonly alignH: TextOptions[\"alignH\"];\n private readonly alignV: TextOptions[\"alignV\"];\n\n constructor(options: TextOptions) {\n this.text = options.text;\n this.size = options.size;\n this.font = options.font;\n this.fill = (options.fill) ? options.fill : null;\n this.stroke = (options.stroke) ? options.stroke : null;\n this.style = (options.style) ? options.style : \"\";\n this.alignH = (options.alignH) ? options.alignH : \"left\";\n this.alignV = (options.alignV) ? options.alignV : \"top\";\n }\n\n draw( layer: Layer, x: number, y: number, w: number, h: number ) {\n layer.ctx.textAlign = this.alignH;\n layer.ctx.textBaseline = this.alignV;\n layer.ctx.font = `${(this.style) ? this.style + \" \": \"\"}${this.size}px ${this.font}`;\n if (this.fill) {\n layer.ctx.fillStyle = this.fill;\n layer.ctx.fillText(this.text, x, y);\n }\n if (this.stroke) {\n layer.ctx.strokeStyle = this.stroke;\n layer.ctx.strokeText(this.text, x, y);\n }\n }\n}\n\nexport let Asset = {\n Image, Text, Arc, Circle, Rectangle, Primitive, TileMap, Font\n};\n\nexport default Asset;"],"names":[],"version":3,"file":"main.js.map"}
|