diff options
author | sanine <sanine.not@pm.me> | 2022-05-27 14:58:39 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-05-27 14:58:39 -0500 |
commit | f66771603d26d8953b574748b91d0ff035551816 (patch) | |
tree | c03a975379d9baf25fec09a30f2036bd0ecbcdd1 /main.js | |
parent | f530261f31905e8e51396c080165b6fc0da386fa (diff) |
add basic terrain generation
Diffstat (limited to 'main.js')
-rw-r--r-- | main.js | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -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); +} |