wgpu/examples/static/index.html
Connor Fitzgerald 7a37229630
Revamp Examples to Match Website (#4765)
* Revamp examples to match website

* Small fixes

* Fix stencil_triangles on resize

* Fix

* Fix everything
2023-11-25 17:20:11 -05:00

122 lines
3.1 KiB
HTML

<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
<style type="text/css">
:focus {
outline: none;
}
body {
margin: 0px;
background: #fff;
font-family: "Calibri", "Arial", sans-serif;
width: 100%;
height: 100%;
}
.root {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.banner {
background: #dee;
padding: 0.5em 0;
border-bottom: 1px solid #abb;
}
.banner-prefix {
text-align: center;
}
p {
font-size: 0.8em;
padding: 0;
margin: 0.5em 0;
}
.backend-list-container {
display: flex;
flex-direction: row;
justify-content: space-evenly;
}
.backend-list {
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: center;
}
.item-list {
display: flex;
flex-direction: column;
flex-wrap: wrap;
align-content: center;
height: 100px;
}
.example-link {
margin-left: 7px;
margin-right: 7px;
}
.backend-name {
text-align: center;
}
.main-canvas {
margin: 0;
/* This allows the flexbox to grow to max size, this is needed for WebGPU */
flex: 1;
/* This forces CSS to ignore the width/height of the canvas, this is needed for WebGL */
contain: size;
}
</style>
</head>
<body>
<div class="root">
<div class="banner">
<div class="banner-prefix">
<p>
<a href="../index.html">
Back to home page
</a>
</p>
</div>
<div class="backend-list-container">
<div class="backend-list">
<p class="backend-name">WebGL2</p>
<div class="item-list" id="webgl2-list">
</div>
</div>
<div class="backend-list">
<p class="backend-name">WebGPU</p>
<div class="item-list" id="webgpu-list">
</div>
</div>
</div>
</div>
<canvas class="main-canvas" id="canvas"></canvas>
</div>
<script type="module">
const params = new URLSearchParams(window.location.search);
const backend = params.get("backend");
const example = params.get("example");
if (backend !== null && example !== null) {
import(`./${backend}.js`).then((module) => module.default());
} else {
window.location.assign(
`${window.location.href}?backend=webgl2&example=hello_triangle`
);
}
</script>
</body>
</html>