some minor tweaks
This commit is contained in:
parent
3aea38f9f4
commit
7b6dbb295f
BIN
public/blobs/snr/audio/ding.mp3
Normal file
BIN
public/blobs/snr/audio/ding.mp3
Normal file
Binary file not shown.
@ -41,7 +41,7 @@ export class ResourceManager {
|
||||
) {
|
||||
const identifier = parseNamespacedId(name);
|
||||
if (typeof (value as EventSource).addEventListener === "function") {
|
||||
if (value instanceof Image) {
|
||||
if (value instanceof Image || value instanceof Audio) {
|
||||
// During development, we can use the local file system
|
||||
value.src =
|
||||
`/blobs/${identifier.namespace}/${identifier.type}/${identifier.name}${
|
||||
@ -55,8 +55,10 @@ export class ResourceManager {
|
||||
const onload = () => {
|
||||
this.resources.set(name, value);
|
||||
resolve(true);
|
||||
(value as EventSource).removeEventListener("loadeddata", onload);
|
||||
(value as EventSource).removeEventListener("load", onload);
|
||||
};
|
||||
(value as EventSource).addEventListener("loadeddata", onload);
|
||||
(value as EventSource).addEventListener("load", onload);
|
||||
}),
|
||||
);
|
||||
|
7
src/math/angle.ts
Normal file
7
src/math/angle.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export function angleToRadians(angle: number) {
|
||||
return angle / 180 * Math.PI;
|
||||
}
|
||||
|
||||
export function angleToDegrees(angle: number) {
|
||||
return angle * 180 / Math.PI;
|
||||
}
|
@ -39,9 +39,11 @@ export class LoadState extends State<States> {
|
||||
resources.set("snr:sprite/LargeLady", new Image());
|
||||
// resources.get<HTMLImageElement>("snr:sprite/engine")!.src =
|
||||
// "/sprites/EngineSprites.png";
|
||||
|
||||
resources.set("snr:audio/ding", new Audio());
|
||||
resources.ready().then(() => {
|
||||
this.stateMachine.transitionTo(States.RUNNING);
|
||||
});
|
||||
}).catch((e) => console.error(e));
|
||||
|
||||
const doodler = getContextItem<Doodler>("doodler");
|
||||
// this.layers.push(doodler.createLayer((_, __, dTime) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user