@hi-ashleyj/llama 0.2.1 → 0.3.0
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/components/Game.svelte +30 -6
- package/components/Game.svelte.d.ts +5 -9
- package/components/GameObject.svelte.d.ts +5 -5
- package/components/Layer.svelte.d.ts +1 -1
- package/components/controller.d.ts +26 -0
- package/components/controller.js +59 -0
- package/components/{Drawables → drawables}/Arc.svelte +2 -2
- package/components/{Drawables → drawables}/Arc.svelte.d.ts +2 -2
- package/components/{Drawables → drawables}/Circle.svelte +1 -1
- package/components/{Drawables → drawables}/Circle.svelte.d.ts +2 -2
- package/components/drawables/DisplayImage.svelte +13 -0
- package/components/drawables/DisplayImage.svelte.d.ts +22 -0
- package/components/{Drawables → drawables}/Rectangle.svelte +0 -0
- package/components/{Drawables → drawables}/Rectangle.svelte.d.ts +2 -2
- package/components/drawables/Text.svelte +28 -0
- package/components/drawables/Text.svelte.d.ts +23 -0
- package/components/{Drawables → drawables}/index.d.ts +2 -0
- package/components/{Drawables → drawables}/index.js +2 -0
- package/components/motions.d.ts +1 -1
- package/components/resources/images.d.ts +1 -0
- package/components/resources/images.js +9 -0
- package/drawables.d.ts +1 -0
- package/drawables.js +1 -0
- package/index.d.ts +3 -1
- package/index.js +3 -1
- package/package.json +12 -6
- package/resources.d.ts +1 -0
- package/resources.js +1 -0
- package/types/contexts.d.ts +9 -1
- package/Drawables.d.ts +0 -1
- package/Drawables.js +0 -1
package/components/Game.svelte
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
<script>import { writable } from "svelte/store";
|
|
2
|
-
import { onMount
|
|
2
|
+
import { onMount } from "svelte";
|
|
3
3
|
import { setupGame } from "../setup";
|
|
4
4
|
import { Timing } from "./motions";
|
|
5
|
-
|
|
5
|
+
import { Controller } from "./controller";
|
|
6
6
|
export let width = 1920;
|
|
7
7
|
export let height = 1080;
|
|
8
8
|
export let background = "#000000";
|
|
9
|
+
// noinspection JSUnusedAssignment
|
|
9
10
|
const widthStore = writable(1920);
|
|
11
|
+
// noinspection JSUnusedAssignment
|
|
10
12
|
const heightStore = writable(1080);
|
|
13
|
+
// noinspection JSUnusedAssignment
|
|
11
14
|
const backgroundStore = writable("#000000");
|
|
12
15
|
$: {
|
|
13
16
|
$widthStore = width;
|
|
@@ -29,12 +32,32 @@ const assign = function (layerDraw) {
|
|
|
29
32
|
return () => layers.delete(layerDraw);
|
|
30
33
|
};
|
|
31
34
|
const timing = new Timing();
|
|
35
|
+
const controller = new Controller();
|
|
36
|
+
const frameEvents = new Set();
|
|
37
|
+
const frameBeforeEvents = new Set();
|
|
38
|
+
const frameAfterEvents = new Set();
|
|
39
|
+
// noinspection JSUnusedGlobalSymbols
|
|
32
40
|
export const context = {
|
|
33
41
|
width: widthStore,
|
|
34
42
|
height: heightStore,
|
|
35
43
|
background: backgroundStore,
|
|
36
44
|
assign,
|
|
37
|
-
createTimer: timing.create.bind(timing)
|
|
45
|
+
createTimer: timing.create.bind(timing),
|
|
46
|
+
onKeyboardEvent: controller.on.bind(controller),
|
|
47
|
+
isKeyboardPressed: controller.isPressed.bind(controller),
|
|
48
|
+
getKeyboardStore: controller.getStore.bind(controller),
|
|
49
|
+
onFrame: (callback) => {
|
|
50
|
+
frameEvents.add(callback);
|
|
51
|
+
return () => frameEvents.delete(callback);
|
|
52
|
+
},
|
|
53
|
+
onBeforeFrame: (callback) => {
|
|
54
|
+
frameBeforeEvents.add(callback);
|
|
55
|
+
return () => frameBeforeEvents.delete(callback);
|
|
56
|
+
},
|
|
57
|
+
onAfterFrame: (callback) => {
|
|
58
|
+
frameAfterEvents.add(callback);
|
|
59
|
+
return () => frameAfterEvents.delete(callback);
|
|
60
|
+
},
|
|
38
61
|
};
|
|
39
62
|
setupGame(context);
|
|
40
63
|
let last = -1;
|
|
@@ -47,16 +70,17 @@ const loop = function (time) {
|
|
|
47
70
|
return last = time;
|
|
48
71
|
}
|
|
49
72
|
// TODO: NEW TIMEOUT LOGIC
|
|
50
|
-
|
|
73
|
+
frameBeforeEvents.forEach((callback) => callback({ delta, time }));
|
|
51
74
|
timing.update(delta);
|
|
52
|
-
|
|
75
|
+
frameEvents.forEach((callback) => callback({ delta, time }));
|
|
53
76
|
draw(delta, time);
|
|
54
|
-
|
|
77
|
+
frameAfterEvents.forEach((callback) => callback({ delta, time }));
|
|
55
78
|
requestAnimationFrame(loop);
|
|
56
79
|
last = time;
|
|
57
80
|
};
|
|
58
81
|
onMount(() => {
|
|
59
82
|
requestAnimationFrame(loop);
|
|
83
|
+
controller.start();
|
|
60
84
|
});
|
|
61
85
|
</script>
|
|
62
86
|
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { GameContext } from "../types
|
|
2
|
+
import type { GameContext } from "../types";
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
width?: number;
|
|
6
|
-
height?: number;
|
|
7
|
-
background?: string;
|
|
8
|
-
context?: GameContext;
|
|
5
|
+
width?: number | undefined;
|
|
6
|
+
height?: number | undefined;
|
|
7
|
+
background?: string | undefined;
|
|
8
|
+
context?: GameContext | undefined;
|
|
9
9
|
};
|
|
10
10
|
events: {
|
|
11
|
-
beforeframe: CustomEvent<any>;
|
|
12
|
-
frame: CustomEvent<any>;
|
|
13
|
-
afterframe: CustomEvent<any>;
|
|
14
|
-
} & {
|
|
15
11
|
[evt: string]: CustomEvent<any>;
|
|
16
12
|
};
|
|
17
13
|
slots: {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
x?: number;
|
|
5
|
-
y?: number;
|
|
6
|
-
w?: number;
|
|
7
|
-
h?: number;
|
|
4
|
+
x?: number | undefined;
|
|
5
|
+
y?: number | undefined;
|
|
6
|
+
w?: number | undefined;
|
|
7
|
+
h?: number | undefined;
|
|
8
8
|
/**
|
|
9
9
|
* FALSE = ANCHOR TOP LEFT
|
|
10
10
|
* TRUE = ANCHOR CENTER
|
|
11
|
-
*/ centered?: boolean;
|
|
11
|
+
*/ centered?: boolean | undefined;
|
|
12
12
|
};
|
|
13
13
|
events: {
|
|
14
14
|
[evt: string]: CustomEvent<any>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Writable } from "svelte/store";
|
|
2
|
+
export declare enum CONTROLLER_ACTION {
|
|
3
|
+
DOWN = "down",
|
|
4
|
+
UP = "up",
|
|
5
|
+
PRESS = "press"
|
|
6
|
+
}
|
|
7
|
+
export declare class Controller {
|
|
8
|
+
constructor();
|
|
9
|
+
events: Set<{
|
|
10
|
+
key: string | null;
|
|
11
|
+
action: CONTROLLER_ACTION;
|
|
12
|
+
call: (e: {
|
|
13
|
+
key: string | null;
|
|
14
|
+
action: CONTROLLER_ACTION;
|
|
15
|
+
}) => any | void;
|
|
16
|
+
}>;
|
|
17
|
+
keyState: Map<string, boolean>;
|
|
18
|
+
keyStores: Map<string, Writable<boolean>>;
|
|
19
|
+
start(): void;
|
|
20
|
+
on(key: string | null, action: CONTROLLER_ACTION, callback: (e: {
|
|
21
|
+
key: string | null;
|
|
22
|
+
action: CONTROLLER_ACTION;
|
|
23
|
+
}) => any | void): () => any;
|
|
24
|
+
getStore(key: string): Writable<boolean>;
|
|
25
|
+
isPressed(key: string): boolean;
|
|
26
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { writable } from "svelte/store";
|
|
2
|
+
export var CONTROLLER_ACTION;
|
|
3
|
+
(function (CONTROLLER_ACTION) {
|
|
4
|
+
CONTROLLER_ACTION["DOWN"] = "down";
|
|
5
|
+
CONTROLLER_ACTION["UP"] = "up";
|
|
6
|
+
CONTROLLER_ACTION["PRESS"] = "press";
|
|
7
|
+
})(CONTROLLER_ACTION || (CONTROLLER_ACTION = {}));
|
|
8
|
+
export class Controller {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.events = new Set();
|
|
11
|
+
this.keyState = new Map();
|
|
12
|
+
this.keyStores = new Map();
|
|
13
|
+
}
|
|
14
|
+
events;
|
|
15
|
+
keyState;
|
|
16
|
+
keyStores;
|
|
17
|
+
start() {
|
|
18
|
+
window.addEventListener("keydown", (e) => {
|
|
19
|
+
let eklc = e.key.toLowerCase();
|
|
20
|
+
this.keyState.set(eklc, true);
|
|
21
|
+
this.events.forEach(({ key, action, call }) => {
|
|
22
|
+
if ((key === eklc || key === null) && action === CONTROLLER_ACTION.DOWN)
|
|
23
|
+
call({ key, action });
|
|
24
|
+
});
|
|
25
|
+
if (this.keyStores.has(eklc)) {
|
|
26
|
+
this.keyStores.get(eklc)?.set(true);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
window.addEventListener("keyup", (e) => {
|
|
30
|
+
let eklc = e.key.toLowerCase();
|
|
31
|
+
this.keyState.set(eklc, false);
|
|
32
|
+
this.events.forEach(({ key, action, call }) => {
|
|
33
|
+
if ((key === eklc || key === null) && action === CONTROLLER_ACTION.UP)
|
|
34
|
+
call({ key, action });
|
|
35
|
+
});
|
|
36
|
+
if (this.keyStores.has(eklc)) {
|
|
37
|
+
this.keyStores.get(eklc)?.set(false);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
on(key, action, callback) {
|
|
42
|
+
let obj = { key, action, call: callback };
|
|
43
|
+
this.events.add(obj);
|
|
44
|
+
return () => {
|
|
45
|
+
this.events.delete(obj);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
getStore(key) {
|
|
49
|
+
if (this.keyStores.has(key)) {
|
|
50
|
+
return this.keyStores.get(key);
|
|
51
|
+
}
|
|
52
|
+
let wr = writable(this.keyState.get(key) || false);
|
|
53
|
+
this.keyStores.set(key, wr);
|
|
54
|
+
return wr;
|
|
55
|
+
}
|
|
56
|
+
isPressed(key) {
|
|
57
|
+
return this.keyState.get(key) || false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -8,8 +8,8 @@ $: ed = (endAngle - 90) * Math.PI / 180;
|
|
|
8
8
|
const draw = function ({ ctx }, { x, y, w, h }) {
|
|
9
9
|
let r = (w + h) / 4;
|
|
10
10
|
ctx.beginPath();
|
|
11
|
-
ctx.arc(x + r
|
|
12
|
-
ctx.lineTo(x + r
|
|
11
|
+
ctx.arc(x + r, y + r, r, sd, ed);
|
|
12
|
+
ctx.lineTo(x + r, y + r);
|
|
13
13
|
if (fill) {
|
|
14
14
|
ctx.fillStyle = fill;
|
|
15
15
|
ctx.fill();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
fill?: string | null;
|
|
5
|
-
stroke?: string | null;
|
|
4
|
+
fill?: string | null | undefined;
|
|
5
|
+
stroke?: string | null | undefined;
|
|
6
6
|
};
|
|
7
7
|
events: {
|
|
8
8
|
[evt: string]: CustomEvent<any>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script>import { setupDrawable } from "../../setup";
|
|
2
|
+
export let image = null;
|
|
3
|
+
export let crop = null;
|
|
4
|
+
const draw = function ({ ctx }, { x, y, w, h }) {
|
|
5
|
+
if (!image)
|
|
6
|
+
return;
|
|
7
|
+
if (crop) {
|
|
8
|
+
return ctx.drawImage(image, crop.x, crop.y, crop.w, crop.h, x, y, w, h);
|
|
9
|
+
}
|
|
10
|
+
ctx.drawImage(image, x, y, w, h);
|
|
11
|
+
};
|
|
12
|
+
setupDrawable({ draw });
|
|
13
|
+
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
image?: HTMLImageElement | null | undefined;
|
|
5
|
+
crop?: {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
w: number;
|
|
9
|
+
h: number;
|
|
10
|
+
} | null | undefined;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {};
|
|
16
|
+
};
|
|
17
|
+
export declare type DisplayImageProps = typeof __propDef.props;
|
|
18
|
+
export declare type DisplayImageEvents = typeof __propDef.events;
|
|
19
|
+
export declare type DisplayImageSlots = typeof __propDef.slots;
|
|
20
|
+
export default class DisplayImage extends SvelteComponentTyped<DisplayImageProps, DisplayImageEvents, DisplayImageSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
fill?: string | null;
|
|
5
|
-
stroke?: string | null;
|
|
4
|
+
fill?: string | null | undefined;
|
|
5
|
+
stroke?: string | null | undefined;
|
|
6
6
|
};
|
|
7
7
|
events: {
|
|
8
8
|
[evt: string]: CustomEvent<any>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script>import { setupDrawable } from "../../setup";
|
|
2
|
+
export let text;
|
|
3
|
+
export let size;
|
|
4
|
+
export let font;
|
|
5
|
+
export let style = undefined;
|
|
6
|
+
export let fill = undefined;
|
|
7
|
+
export let stroke = undefined;
|
|
8
|
+
export let alignH = "left";
|
|
9
|
+
export let alignV = "top";
|
|
10
|
+
$: computedFont = ((style) ? style + " " : "") + size + "px " + font;
|
|
11
|
+
const draw = function ({ ctx }, { x, y }) {
|
|
12
|
+
if (!text)
|
|
13
|
+
return;
|
|
14
|
+
ctx.beginPath();
|
|
15
|
+
ctx.textAlign = alignH;
|
|
16
|
+
ctx.textBaseline = alignV;
|
|
17
|
+
ctx.font = computedFont;
|
|
18
|
+
if (fill) {
|
|
19
|
+
ctx.fillStyle = fill;
|
|
20
|
+
ctx.fillText(text, x, y);
|
|
21
|
+
}
|
|
22
|
+
if (stroke) {
|
|
23
|
+
ctx.strokeStyle = stroke;
|
|
24
|
+
ctx.strokeText(text, x, y);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
setupDrawable({ draw });
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
text: string;
|
|
5
|
+
size: number;
|
|
6
|
+
font: string;
|
|
7
|
+
style?: string | undefined;
|
|
8
|
+
fill?: string | undefined;
|
|
9
|
+
stroke?: string | undefined;
|
|
10
|
+
alignH?: "left" | "center" | "right" | undefined;
|
|
11
|
+
alignV?: "top" | "middle" | "bottom" | "alphabetic" | undefined;
|
|
12
|
+
};
|
|
13
|
+
events: {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
};
|
|
16
|
+
slots: {};
|
|
17
|
+
};
|
|
18
|
+
export declare type TextProps = typeof __propDef.props;
|
|
19
|
+
export declare type TextEvents = typeof __propDef.events;
|
|
20
|
+
export declare type TextSlots = typeof __propDef.slots;
|
|
21
|
+
export default class Text extends SvelteComponentTyped<TextProps, TextEvents, TextSlots> {
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { default as Rectangle } from "./Rectangle.svelte";
|
|
2
2
|
export { default as Circle } from "./Circle.svelte";
|
|
3
3
|
export { default as Arc } from "./Arc.svelte";
|
|
4
|
+
export { default as DisplayImage } from "./DisplayImage.svelte";
|
|
5
|
+
export { default as Text } from "./Text.svelte";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { default as Rectangle } from "./Rectangle.svelte";
|
|
2
2
|
export { default as Circle } from "./Circle.svelte";
|
|
3
3
|
export { default as Arc } from "./Arc.svelte";
|
|
4
|
+
export { default as DisplayImage } from "./DisplayImage.svelte";
|
|
5
|
+
export { default as Text } from "./Text.svelte";
|
package/components/motions.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare class Timing {
|
|
|
19
19
|
stop: () => boolean;
|
|
20
20
|
set(this: void, value: number): void;
|
|
21
21
|
update(this: void, updater: import("svelte/store").Updater<number>): void;
|
|
22
|
-
subscribe(this: void, run: import("svelte/store").Subscriber<number>, invalidate?: (value?: number) => void): import("svelte/store").Unsubscriber;
|
|
22
|
+
subscribe(this: void, run: import("svelte/store").Subscriber<number>, invalidate?: ((value?: number | undefined) => void) | undefined): import("svelte/store").Unsubscriber;
|
|
23
23
|
};
|
|
24
24
|
update(delta: number): void;
|
|
25
25
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const resolve: (src: any) => HTMLImageElement;
|
package/drawables.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./components/drawables/index";
|
package/drawables.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./components/drawables/index";
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { default as Game } from "./components/Game.svelte";
|
|
2
2
|
export { default as Layer } from "./components/Layer.svelte";
|
|
3
3
|
export { default as GameObject } from "./components/GameObject.svelte";
|
|
4
|
-
export * as
|
|
4
|
+
export * as drawables from "./components/drawables/index";
|
|
5
|
+
export { setupDrawable, getGame } from "./setup";
|
|
6
|
+
export { resolve as resolveImage } from "./components/resources/images";
|
package/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { default as Game } from "./components/Game.svelte";
|
|
2
2
|
export { default as Layer } from "./components/Layer.svelte";
|
|
3
3
|
export { default as GameObject } from "./components/GameObject.svelte";
|
|
4
|
-
export * as
|
|
4
|
+
export * as drawables from "./components/drawables/index";
|
|
5
|
+
export { setupDrawable, getGame } from "./setup";
|
|
6
|
+
export { resolve as resolveImage } from "./components/resources/images";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hi-ashleyj/llama",
|
|
3
3
|
"description": "A (Very Incomplete) 2D Canvas Game Engine powered by Svelte",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@sveltejs/adapter-static": "next",
|
|
18
18
|
"@sveltejs/kit": "next",
|
|
19
|
+
"@sveltejs/package": "*",
|
|
19
20
|
"svelte": "^3.44.0",
|
|
20
21
|
"svelte-preprocess": "^4.10.7",
|
|
21
22
|
"svelte2tsx": "^0.5.12",
|
|
@@ -24,16 +25,21 @@
|
|
|
24
25
|
},
|
|
25
26
|
"exports": {
|
|
26
27
|
"./package.json": "./package.json",
|
|
27
|
-
"./Drawables": "./Drawables.js",
|
|
28
|
-
"./components/Drawables/Arc.svelte": "./components/Drawables/Arc.svelte",
|
|
29
|
-
"./components/Drawables/Circle.svelte": "./components/Drawables/Circle.svelte",
|
|
30
|
-
"./components/Drawables/Rectangle.svelte": "./components/Drawables/Rectangle.svelte",
|
|
31
|
-
"./components/Drawables": "./components/Drawables/index.js",
|
|
32
28
|
"./components/Game.svelte": "./components/Game.svelte",
|
|
33
29
|
"./components/GameObject.svelte": "./components/GameObject.svelte",
|
|
34
30
|
"./components/Layer.svelte": "./components/Layer.svelte",
|
|
31
|
+
"./components/controller": "./components/controller.js",
|
|
32
|
+
"./components/drawables/Arc.svelte": "./components/drawables/Arc.svelte",
|
|
33
|
+
"./components/drawables/Circle.svelte": "./components/drawables/Circle.svelte",
|
|
34
|
+
"./components/drawables/DisplayImage.svelte": "./components/drawables/DisplayImage.svelte",
|
|
35
|
+
"./components/drawables/Rectangle.svelte": "./components/drawables/Rectangle.svelte",
|
|
36
|
+
"./components/drawables/Text.svelte": "./components/drawables/Text.svelte",
|
|
37
|
+
"./components/drawables": "./components/drawables/index.js",
|
|
35
38
|
"./components/motions": "./components/motions.js",
|
|
39
|
+
"./components/resources/images": "./components/resources/images.js",
|
|
40
|
+
"./drawables": "./drawables.js",
|
|
36
41
|
".": "./index.js",
|
|
42
|
+
"./resources": "./resources.js",
|
|
37
43
|
"./setup": "./setup.js"
|
|
38
44
|
},
|
|
39
45
|
"svelte": "./index.js"
|
package/resources.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as images } from "./components/resources/images";
|
package/resources.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as images } from "./components/resources/images";
|
package/types/contexts.d.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { Writable } from 'svelte/store';
|
|
2
2
|
import { Timing } from "../components/motions";
|
|
3
|
+
import { Controller } from "../components/controller";
|
|
3
4
|
|
|
4
5
|
export type GameContext = {
|
|
5
6
|
assign: (draw: Function) => () => any,
|
|
6
7
|
width: Writable<number>,
|
|
7
8
|
height: Writable<number>,
|
|
8
9
|
background: Writable<string>,
|
|
9
|
-
createTimer: Timing["create"]
|
|
10
|
+
createTimer: Timing["create"],
|
|
11
|
+
onKeyboardEvent: Controller["on"],
|
|
12
|
+
isKeyboardPressed: Controller["isPressed"],
|
|
13
|
+
getKeyboardStore: Controller["getStore"],
|
|
14
|
+
onFrame: (callback: Function) => () => any,
|
|
15
|
+
onBeforeFrame: (callback: Function) => () => any,
|
|
16
|
+
onAfterFrame: (callback: Function) => () => any,
|
|
17
|
+
|
|
10
18
|
};
|
|
11
19
|
|
|
12
20
|
export type LayerContext = {
|
package/Drawables.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./components/Drawables/index";
|
package/Drawables.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./components/Drawables/index";
|