From f66771603d26d8953b574748b91d0ff035551816 Mon Sep 17 00:00:00 2001 From: sanine Date: Fri, 27 May 2022 14:58:39 -0500 Subject: add basic terrain generation --- main.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 main.js (limited to 'main.js') diff --git a/main.js b/main.js new file mode 100644 index 0000000..d02e0fb --- /dev/null +++ b/main.js @@ -0,0 +1,21 @@ +import Voronoi from './modules/3rdparty/rhill-voronoi-core.js'; +import Terrain from './modules/Terrain.js'; + +const $ = id => document.getElementById(id) + +window.onload = () => { + let canvas = document.createElement('canvas'); + canvas.setAttribute('width', window.innerWidth); + canvas.setAttribute('height', window.innerHeight); + const ct = canvas.getContext('2d'); + + const scale = Math.min(window.innerWidth, window.innerHeight); + ct.scale(scale, scale); + + const terrain = new Terrain(); + terrain.renderGrid(ct); + + + const root = $('root'); + root.appendChild(canvas); +} -- cgit v1.2.1