@hi-ashleyj/llama 0.5.0 → 0.6.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 +2 -1
- package/components/Game.svelte.d.ts +3 -3
- package/components/GameObject.svelte.d.ts +3 -3
- package/components/Layer.svelte.d.ts +3 -3
- package/components/drawables/Arc.svelte.d.ts +3 -3
- package/components/drawables/Circle.svelte.d.ts +3 -3
- package/components/drawables/DisplayImage.svelte.d.ts +3 -3
- package/components/drawables/MultiLineText.svelte.d.ts +3 -3
- package/components/drawables/Rectangle.svelte.d.ts +3 -3
- package/components/drawables/Text.svelte.d.ts +3 -3
- package/components/motions.d.ts +16 -1
- package/components/motions.js +19 -1
- package/package.json +6 -5
- package/types/contexts.d.ts +2 -1
package/components/Game.svelte
CHANGED
|
@@ -42,7 +42,8 @@ export const context = {
|
|
|
42
42
|
height: heightStore,
|
|
43
43
|
background: backgroundStore,
|
|
44
44
|
assign,
|
|
45
|
-
createTimer: timing.
|
|
45
|
+
createTimer: timing.createTimer.bind(timing),
|
|
46
|
+
createBurst: timing.createBurst.bind(timing),
|
|
46
47
|
onKeyboardEvent: controller.on.bind(controller),
|
|
47
48
|
isKeyboardPressed: controller.isPressed.bind(controller),
|
|
48
49
|
getKeyboardStore: controller.getStore.bind(controller),
|
|
@@ -14,9 +14,9 @@ declare const __propDef: {
|
|
|
14
14
|
default: {};
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
17
|
+
export type GameProps = typeof __propDef.props;
|
|
18
|
+
export type GameEvents = typeof __propDef.events;
|
|
19
|
+
export type GameSlots = typeof __propDef.slots;
|
|
20
20
|
export default class Game extends SvelteComponentTyped<GameProps, GameEvents, GameSlots> {
|
|
21
21
|
get context(): GameContext;
|
|
22
22
|
}
|
|
@@ -18,9 +18,9 @@ declare const __propDef: {
|
|
|
18
18
|
default: {};
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
21
|
+
export type GameObjectProps = typeof __propDef.props;
|
|
22
|
+
export type GameObjectEvents = typeof __propDef.events;
|
|
23
|
+
export type GameObjectSlots = typeof __propDef.slots;
|
|
24
24
|
export default class GameObject extends SvelteComponentTyped<GameObjectProps, GameObjectEvents, GameObjectSlots> {
|
|
25
25
|
}
|
|
26
26
|
export {};
|
|
@@ -10,9 +10,9 @@ declare const __propDef: {
|
|
|
10
10
|
default: {};
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
13
|
+
export type LayerProps = typeof __propDef.props;
|
|
14
|
+
export type LayerEvents = typeof __propDef.events;
|
|
15
|
+
export type LayerSlots = typeof __propDef.slots;
|
|
16
16
|
export default class Layer extends SvelteComponentTyped<LayerProps, LayerEvents, LayerSlots> {
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -11,9 +11,9 @@ declare const __propDef: {
|
|
|
11
11
|
};
|
|
12
12
|
slots: {};
|
|
13
13
|
};
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
14
|
+
export type ArcProps = typeof __propDef.props;
|
|
15
|
+
export type ArcEvents = typeof __propDef.events;
|
|
16
|
+
export type ArcSlots = typeof __propDef.slots;
|
|
17
17
|
export default class Arc extends SvelteComponentTyped<ArcProps, ArcEvents, ArcSlots> {
|
|
18
18
|
}
|
|
19
19
|
export {};
|
|
@@ -9,9 +9,9 @@ declare const __propDef: {
|
|
|
9
9
|
};
|
|
10
10
|
slots: {};
|
|
11
11
|
};
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
12
|
+
export type CircleProps = typeof __propDef.props;
|
|
13
|
+
export type CircleEvents = typeof __propDef.events;
|
|
14
|
+
export type CircleSlots = typeof __propDef.slots;
|
|
15
15
|
export default class Circle extends SvelteComponentTyped<CircleProps, CircleEvents, CircleSlots> {
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -14,9 +14,9 @@ declare const __propDef: {
|
|
|
14
14
|
};
|
|
15
15
|
slots: {};
|
|
16
16
|
};
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
17
|
+
export type DisplayImageProps = typeof __propDef.props;
|
|
18
|
+
export type DisplayImageEvents = typeof __propDef.events;
|
|
19
|
+
export type DisplayImageSlots = typeof __propDef.slots;
|
|
20
20
|
export default class DisplayImage extends SvelteComponentTyped<DisplayImageProps, DisplayImageEvents, DisplayImageSlots> {
|
|
21
21
|
}
|
|
22
22
|
export {};
|
|
@@ -16,9 +16,9 @@ declare const __propDef: {
|
|
|
16
16
|
};
|
|
17
17
|
slots: {};
|
|
18
18
|
};
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
19
|
+
export type MultiLineTextProps = typeof __propDef.props;
|
|
20
|
+
export type MultiLineTextEvents = typeof __propDef.events;
|
|
21
|
+
export type MultiLineTextSlots = typeof __propDef.slots;
|
|
22
22
|
export default class MultiLineText extends SvelteComponentTyped<MultiLineTextProps, MultiLineTextEvents, MultiLineTextSlots> {
|
|
23
23
|
}
|
|
24
24
|
export {};
|
|
@@ -9,9 +9,9 @@ declare const __propDef: {
|
|
|
9
9
|
};
|
|
10
10
|
slots: {};
|
|
11
11
|
};
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
12
|
+
export type RectangleProps = typeof __propDef.props;
|
|
13
|
+
export type RectangleEvents = typeof __propDef.events;
|
|
14
|
+
export type RectangleSlots = typeof __propDef.slots;
|
|
15
15
|
export default class Rectangle extends SvelteComponentTyped<RectangleProps, RectangleEvents, RectangleSlots> {
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -15,9 +15,9 @@ declare const __propDef: {
|
|
|
15
15
|
};
|
|
16
16
|
slots: {};
|
|
17
17
|
};
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
18
|
+
export type TextProps = typeof __propDef.props;
|
|
19
|
+
export type TextEvents = typeof __propDef.events;
|
|
20
|
+
export type TextSlots = typeof __propDef.slots;
|
|
21
21
|
export default class Text extends SvelteComponentTyped<TextProps, TextEvents, TextSlots> {
|
|
22
22
|
}
|
|
23
23
|
export {};
|
package/components/motions.d.ts
CHANGED
|
@@ -6,13 +6,14 @@ export declare class Timing {
|
|
|
6
6
|
duration: number;
|
|
7
7
|
repeats: number;
|
|
8
8
|
store: Writable<number | null>;
|
|
9
|
+
burst?: boolean;
|
|
9
10
|
}>;
|
|
10
11
|
/**
|
|
11
12
|
* Used to create a store whose value changes based on the total delta time.
|
|
12
13
|
* Duration is in MS
|
|
13
14
|
* Use 0 for repeats for infinite
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
+
createTimer({ duration, repeats }: {
|
|
16
17
|
duration: number;
|
|
17
18
|
repeats: number;
|
|
18
19
|
}): {
|
|
@@ -21,5 +22,19 @@ export declare class Timing {
|
|
|
21
22
|
update(this: void, updater: import("svelte/store").Updater<number>): void;
|
|
22
23
|
subscribe(this: void, run: import("svelte/store").Subscriber<number>, invalidate?: ((value?: number | undefined) => void) | undefined): import("svelte/store").Unsubscriber;
|
|
23
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Used to create a store whose value adjusts based on bursts.
|
|
27
|
+
* Duration is in MS
|
|
28
|
+
*/
|
|
29
|
+
createBurst({ duration, initialTrigger }: {
|
|
30
|
+
duration: number;
|
|
31
|
+
initialTrigger?: boolean;
|
|
32
|
+
}): {
|
|
33
|
+
stop: () => boolean;
|
|
34
|
+
trigger: () => void;
|
|
35
|
+
set(this: void, value: number): void;
|
|
36
|
+
update(this: void, updater: import("svelte/store").Updater<number>): void;
|
|
37
|
+
subscribe(this: void, run: import("svelte/store").Subscriber<number>, invalidate?: ((value?: number | undefined) => void) | undefined): import("svelte/store").Unsubscriber;
|
|
38
|
+
};
|
|
24
39
|
update(delta: number): void;
|
|
25
40
|
}
|
package/components/motions.js
CHANGED
|
@@ -9,7 +9,7 @@ export class Timing {
|
|
|
9
9
|
* Duration is in MS
|
|
10
10
|
* Use 0 for repeats for infinite
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
createTimer({ duration, repeats }) {
|
|
13
13
|
let store = { ...writable(0), stop: () => this.targets.delete(out) };
|
|
14
14
|
let out = {
|
|
15
15
|
current: 0,
|
|
@@ -20,9 +20,27 @@ export class Timing {
|
|
|
20
20
|
this.targets.add(out);
|
|
21
21
|
return store;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Used to create a store whose value adjusts based on bursts.
|
|
25
|
+
* Duration is in MS
|
|
26
|
+
*/
|
|
27
|
+
createBurst({ duration, initialTrigger }) {
|
|
28
|
+
let store = { ...writable(initialTrigger ? 0 : 1), stop: () => this.targets.delete(out), trigger: () => { store.set(0); out.current = 0; } };
|
|
29
|
+
let out = {
|
|
30
|
+
current: initialTrigger ? 0 : -1,
|
|
31
|
+
duration,
|
|
32
|
+
repeats: 1,
|
|
33
|
+
store,
|
|
34
|
+
burst: true
|
|
35
|
+
};
|
|
36
|
+
this.targets.add(out);
|
|
37
|
+
return store;
|
|
38
|
+
}
|
|
23
39
|
update(delta) {
|
|
24
40
|
this.targets.forEach((t, ignored, set) => {
|
|
25
41
|
if (t.current < 0) {
|
|
42
|
+
if (t.burst)
|
|
43
|
+
return; // do not destroy stores for bursts
|
|
26
44
|
t.store.set(null);
|
|
27
45
|
set.delete(t);
|
|
28
46
|
return;
|
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.6.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -14,14 +14,15 @@
|
|
|
14
14
|
},
|
|
15
15
|
"homepage": "https://github.com/hi-ashleyj/llama-game-engine#readme",
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@sveltejs/adapter-static": "
|
|
18
|
-
"@sveltejs/kit": "
|
|
19
|
-
"@sveltejs/package": "
|
|
17
|
+
"@sveltejs/adapter-static": "latest",
|
|
18
|
+
"@sveltejs/kit": "latest",
|
|
19
|
+
"@sveltejs/package": "latest",
|
|
20
|
+
"sass": "^1.58.0",
|
|
20
21
|
"svelte": "^3.44.0",
|
|
21
22
|
"svelte-preprocess": "^4.10.7",
|
|
22
23
|
"svelte2tsx": "^0.5.12",
|
|
23
24
|
"typescript": "^4.7.4",
|
|
24
|
-
"vite": "^
|
|
25
|
+
"vite": "^4.0.0"
|
|
25
26
|
},
|
|
26
27
|
"exports": {
|
|
27
28
|
"./package.json": "./package.json",
|
package/types/contexts.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export type GameContext = {
|
|
|
7
7
|
width: Writable<number>,
|
|
8
8
|
height: Writable<number>,
|
|
9
9
|
background: Writable<string>,
|
|
10
|
-
createTimer: Timing["
|
|
10
|
+
createTimer: Timing["createTimer"],
|
|
11
|
+
createBurst: Timing["createBurst"],
|
|
11
12
|
onKeyboardEvent: Controller["on"],
|
|
12
13
|
isKeyboardPressed: Controller["isPressed"],
|
|
13
14
|
getKeyboardStore: Controller["getStore"],
|