Copy utils
This commit is contained in:
parent
d8a3ae7528
commit
a3f76f5c77
14 changed files with 141 additions and 3 deletions
32
src/index.ts
32
src/index.ts
|
|
@ -1,10 +1,36 @@
|
|||
import GameLoop from './game-loop/game-loop';
|
||||
import './styles/index.scss';
|
||||
import { applyArrayPlugins } from './utils/array';
|
||||
|
||||
declare global {
|
||||
interface Array<T> {
|
||||
x: T;
|
||||
y: T;
|
||||
}
|
||||
|
||||
interface ReadonlyArray<T> {
|
||||
x: T;
|
||||
y: T;
|
||||
}
|
||||
|
||||
interface Float32Array {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
}
|
||||
|
||||
applyArrayPlugins();
|
||||
|
||||
const errorContainer = document.querySelector('.errors');
|
||||
|
||||
const main = () => {
|
||||
const canvas = document.querySelector('canvas');
|
||||
const game = new GameLoop(canvas);
|
||||
game.start();
|
||||
try {
|
||||
const canvas = document.querySelector('canvas');
|
||||
const game = new GameLoop(canvas);
|
||||
game.start();
|
||||
} catch (e) {
|
||||
errorContainer.innerHTML = e.message;
|
||||
}
|
||||
};
|
||||
|
||||
main();
|
||||
|
|
|
|||
Loading…
Reference in a new issue