center canvas

This commit is contained in:
klangner 2020-09-14 14:30:59 +02:00
parent 55aa589355
commit ce6a29d899
2 changed files with 9 additions and 4 deletions

View File

@ -9,6 +9,13 @@
body {
background-color: lightgrey;
}
canvas {
padding-left: 0;
padding-right: 0;
margin-left: auto;
margin-right: auto;
display: block;
}
</style>
<script src="./bootstrap.js"></script>
</head>
@ -37,7 +44,7 @@
</nav>
<canvas id="mapgen-canvas"></canvas>
<div id="map-info"></div>
<div id="map-info" style="text-align: center"></div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>

View File

@ -23,10 +23,8 @@ const ctx = canvas.getContext('2d');
function newCellularAutomata() {
var seed = Date.now();
world = World.new_cellular_automata(width, height, seed);
drawGrid();
drawCells();
requestAnimationFrame(renderLoop);
infoDiv.textContent = "Cellular automata with the seed: " + seed;
infoDiv.textContent = "Cellular Automata with the seed: " + seed;
}
function newSimpleRooms() {