feat(map-generator): use biome models for generating the biome layer
This commit is contained in:
7
biomes/static/bootstrap.min.css
vendored
Normal file
7
biomes/static/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
biomes/static/bootstrap.min.css.map
Normal file
1
biomes/static/bootstrap.min.css.map
Normal file
File diff suppressed because one or more lines are too long
7
biomes/static/bootstrap.min.js
vendored
Normal file
7
biomes/static/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
biomes/static/bootstrap.min.js.map
Normal file
1
biomes/static/bootstrap.min.js.map
Normal file
File diff suppressed because one or more lines are too long
29
biomes/static/script.js
Normal file
29
biomes/static/script.js
Normal file
@ -0,0 +1,29 @@
|
||||
const mapSettings = document.getElementById('map-settings');
|
||||
//const board = document.getElementById('board');
|
||||
const map = document.getElementById('map');
|
||||
const spinner = document.getElementById('spinner');
|
||||
|
||||
function generate() {
|
||||
spinner.classList.remove('d-none');
|
||||
const formData = new FormData(mapSettings)
|
||||
if (!formData.get('seed')) {
|
||||
formData.set('seed', (new Date()).getTime() % 1e5);
|
||||
}
|
||||
const queryString = new URLSearchParams(formData).toString()
|
||||
map.src = '/map?' + queryString;
|
||||
map.classList.add('d-none');
|
||||
map.width = formData.get('width');
|
||||
}
|
||||
|
||||
mapSettings.addEventListener('submit', (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
generate()
|
||||
});
|
||||
|
||||
generate()
|
||||
|
||||
map.addEventListener('load', () => {
|
||||
spinner.classList.add('d-none');
|
||||
map.classList.remove('d-none');
|
||||
});
|
15
biomes/static/style.css
Normal file
15
biomes/static/style.css
Normal file
@ -0,0 +1,15 @@
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
aside {
|
||||
text-align: center;
|
||||
width: 300px;
|
||||
height: 100vh;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
Reference in New Issue
Block a user