added bootstrap
This commit is contained in:
parent
b94ff668cc
commit
de8ef49de3
@ -1,6 +1,8 @@
|
||||
Game of Life
|
||||
===============
|
||||
|
||||
![gof-ci](https://github.com/sarsoo/game-of-life/actions/workflows/test.yml/badge.svg)
|
||||
|
||||
## [Try it Out!](https://sarsoo.github.io/game-of-life/)
|
||||
|
||||
WASM-based game of life following the [Rust WASM book](https://rustwasm.github.io/docs/book/introduction.html) tutorial.
|
||||
|
128
www/index.html
128
www/index.html
@ -1,38 +1,106 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
|
||||
<title>game of life</title>
|
||||
<style>
|
||||
body {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
body {
|
||||
/* position: absolute; */
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: monospace;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<input type="range" id="frameRate" name="frameRate" min="1" max="500" value="50">
|
||||
<label for="frameRate" id="frameRate-label">Frame Interval: 50</label>
|
||||
<input type="range" id="randThreshold" name="randThreshold" min="0" max="100" value="50">
|
||||
<label for="randThreshold" id="randThreshold-label">Rand Threshold: 50</label>
|
||||
<input type="number" id="width" name="width" min="1" max="1000" value="100">
|
||||
<label for="width">width</label>
|
||||
<input type="number" id="height" name="height" min="1" max="1000" value="100">
|
||||
<label for="height">height</label>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="card container-xs text-center p-4 m-3">
|
||||
<div class="card-header">
|
||||
<h1>Game of Life</h1>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row p-3">
|
||||
<div class="col-sm-6">
|
||||
<input type="range"
|
||||
id="frameRate"
|
||||
name="frameRate"
|
||||
min="1" max="500" value="50"
|
||||
class="form-range">
|
||||
<label for="frameRate"
|
||||
id="frameRate-label"
|
||||
class="form-label">Frame Interval: 50</label>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<input type="range"
|
||||
id="randThreshold"
|
||||
name="randThreshold"
|
||||
min="0" max="100" value="50"
|
||||
class="form-range">
|
||||
<label for="randThreshold"
|
||||
id="randThreshold-label"
|
||||
class="form-label">Rand Threshold: 50</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row p-3">
|
||||
<div class="col-sm-6">
|
||||
<input type="number"
|
||||
id="width"
|
||||
name="width"
|
||||
min="1" max="1000" value="100"
|
||||
class="form-control">
|
||||
<label for="width">width</label>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<input type="number"
|
||||
id="height"
|
||||
name="height"
|
||||
min="1" max="1000" value="100"
|
||||
class="form-control">
|
||||
<label for="height">height</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row p-3 align-items-center">
|
||||
<div class="col-sm-6">
|
||||
<input type="checkbox"
|
||||
id="play-check"
|
||||
name="play-check"
|
||||
class="form-check-input">
|
||||
<label for="play-check">Play</label>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="row p-1">
|
||||
<button id="step" class="btn btn-primary">Step</button>
|
||||
</div>
|
||||
<div class="row p-1">
|
||||
<button id="reset" class="btn btn-primary">Reset</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <pre id="game-of-life-canvas"></pre> -->
|
||||
<canvas id="game-of-life-canvas"></canvas>
|
||||
<input type="checkbox" id="play-check" name="play-check">
|
||||
<label for="play-check">Play</label>
|
||||
<button id="step">Step</button>
|
||||
<button id="reset">Reset</button>
|
||||
<div id="fps"></div>
|
||||
<canvas id="game-of-life-canvas" class="pb-2"></canvas>
|
||||
|
||||
<script src="./bootstrap.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<img src="https://storage.googleapis.com/sarsooxyzstatic/andy.png" class=" pb-2" style="width: 150px" />
|
||||
|
||||
<!-- <div id="fps"></div> -->
|
||||
</body>
|
||||
|
||||
</html>
|
@ -72,7 +72,7 @@ const drawCells = () => {
|
||||
};
|
||||
|
||||
const renderSingle = () => {
|
||||
fps.render(); //new
|
||||
// fps.render(); //new
|
||||
universe.tick();
|
||||
|
||||
drawGrid();
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "game-of-life-web",
|
||||
"version": "0.1.0",
|
||||
"description": "basic wasm-based game-of-life",
|
||||
"description": "Rust wasm-based game-of-life",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "webpack --config webpack.config.js",
|
||||
|
Loading…
Reference in New Issue
Block a user