blob: 033e4ea8d26d27be531b64e06480f9241369652d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import MapData from './model/data/MapData';
import MapState from './model/state/MapState';
import {loadMap} from './view/MapLoader';
import Renderer from './view/renderer/Renderer';
window.onload = () => {
const canvas = document.getElementById('rpgedit') as HTMLCanvasElement;
if (!canvas)
return;
const renderer = new Renderer(canvas);
const xhr = new XMLHttpRequest();
xhr.addEventListener('load', async function() {
const mapData = new MapData(JSON.parse(this.responseText));
const map = new MapState(mapData);
const mapView = await loadMap(renderer, map);
mapView.draw();
});
xhr.open('GET', 'resources/map/test.json', true);
xhr.send();
};
|