Skip to content

Commit

Permalink
Add gifs and website build to dist
Browse files Browse the repository at this point in the history
  • Loading branch information
Leundai committed Oct 25, 2023
1 parent eaca8a9 commit 9283746
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 14 deletions.
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,36 @@

<h1><code>Game Of Life Rust WASM</code></h1>

<p>
<a href="https://travis-ci.org/rustwasm/wasm-pack-template"><img src="https://img.shields.io/travis/rustwasm/wasm-pack-template.svg?style=flat-square" alt="Build Status" /></a>
</p>

<h3>
<a href="https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html">Tutorial</a>
<span> | </span>
<a href="https://discordapp.com/channels/442252698964721669/443151097398296587">Chat</a>
</h3>

<sub>Built with 🦀🕸 by <a href="https://rustwasm.github.io/">The Rust and WebAssembly Working Group</a></sub>

</div>

![Sample Game Of Life](media/sample.gif)

## About

### 🛠️ Build with `wasm-pack build`

```
cd rust
wasm-pack build
```

### 🔬 Test in Headless Browsers with `wasm-pack test`

```
cd rust
wasm-pack test --headless --chrome
```

### 🏠 Run website locally

```
cd web
npm install
npm run start
```

## 🔋 Batteries Included

- [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen) for communicating
Expand Down
Binary file added media/sample.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl Universe {

pub fn new(width: u32, height: u32) -> Universe {
utils::set_panic_hook();
let cells = Universe::get_random_universe(&width, &height);
let cells = (0..width * height).map(|_| Cell::Dead).collect();

Universe {
speed: DEFAULT_SPEED,
Expand Down
Binary file added web/dist/619d601988458a9ddef8.module.wasm
Binary file not shown.
Binary file removed web/dist/70c7a3d4af60d9e17b97.module.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion web/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
align-items: center;
justify-content: center;
}</style><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css"/><script defer="defer" src="js/app.js"></script><style type="text/css">*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.fixed{position:fixed}.left-auto{left:auto}.right-0{right:0}.my-4{margin-top:1rem;margin-bottom:1rem}.inline-block{display:inline-block}.flex{display:flex}.h-8{height:2rem}.h-fit{height:-moz-fit-content;height:fit-content}.w-8{width:2rem}.w-fit{width:-moz-fit-content;width:fit-content}.cursor-pointer{cursor:pointer}.resize{resize:both}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:.5rem}.gap-4{gap:1rem}.rounded-2xl{border-radius:1rem}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-indigo-800{--tw-border-opacity: 1;border-color:rgb(55 48 163 / var(--tw-border-opacity))}.border-indigo-800\/20{border-color:#3730a333}.border-transparent{border-color:transparent}.bg-indigo-800{--tw-bg-opacity: 1;background-color:rgb(55 48 163 / var(--tw-bg-opacity))}.bg-neutral-200{--tw-bg-opacity: 1;background-color:rgb(229 229 229 / var(--tw-bg-opacity))}.bg-neutral-50\/50{background-color:#fafafa80}.p-6{padding:1.5rem}.text-center{text-align:center}.text-indigo-800{--tw-text-opacity: 1;color:rgb(55 48 163 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.hover\:bg-indigo-800:hover{--tw-bg-opacity: 1;background-color:rgb(55 48 163 / var(--tw-bg-opacity))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.hover\:transition:hover{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}
</style></head><body class="bg-neutral-200 flex flex-row gap-4"><canvas id="game-of-life-canvas"></canvas><div class="fixed right-0 left-auto w-fit h-fit rounded-2xl border border-indigo-800/20 backdrop-blur-sm bg-neutral-50/50 flex flex-col justify-center items-center p-6"><div class="flex flex-col my-4 gap-2"><button class="inline-block rounded-lg border border-transparent bg-indigo-800 w-8 h-8 text-center text-white hover:bg-indigo-800 hover:transition" id="play-pause"><i id="play-pause-icon"></i></button> <button class="inline-block rounded-lg border border-indigo-800 w-8 h-8 text-center text-indigo-800 hover:bg-indigo-800 hover:text-white hover:transition" id="reset"><i class="bi bi-trash-fill"></i></button> <button class="inline-block rounded-lg border border-indigo-800 w-8 h-8 text-center text-indigo-800 hover:bg-indigo-800 hover:text-white hover:transition" id="random"><i class="bi bi-shuffle"></i></button></div><div class="flex flex-col"><label class="text-indigo-800">Speed</label> <input type="number" min="1" max="10" value="1" class="w-1/8 cursor-pointer rounded-lg border bg-neutral-50/50 border-indigo-800 text-center text-indigo-800 hover:bg-indigo-800 hover:text-white hover:transition" id="speed"/></div></div></body></html>
</style></head><body class="bg-neutral-200 flex flex-row gap-4"><canvas id="game-of-life-canvas"></canvas><div class="fixed right-0 left-auto w-fit h-fit rounded-2xl border border-indigo-800/20 backdrop-blur-sm bg-neutral-50/50 flex flex-col justify-center items-center p-6"><div class="flex flex-col my-4 gap-2"><button class="inline-block rounded-lg border border-transparent bg-indigo-800 w-8 h-8 text-center text-white hover:bg-indigo-800 hover:transition" id="play-pause"><i id="play-pause-icon"></i></button> <button class="inline-block rounded-lg border border-indigo-800 w-8 h-8 text-center text-indigo-800 hover:bg-indigo-800 hover:text-white hover:transition" id="reset"><i class="bi bi-trash-fill"></i></button> <button class="inline-block rounded-lg border border-indigo-800 w-8 h-8 text-center text-indigo-800 hover:bg-indigo-800 hover:text-white hover:transition" id="random"><i class="bi bi-shuffle"></i></button></div><div class="flex flex-col"><label class="text-indigo-800">Speed</label> <input type="number" min="1" max="10" value="1" class="w-1/8 cursor-pointer rounded-lg border bg-neutral-50/50 border-indigo-800 text-center text-indigo-800 hover:bg-indigo-800 hover:text-white hover:transition" id="speed"/></div><div id="fps"></div></div></body></html>
2 changes: 1 addition & 1 deletion web/dist/js/115.e39.js → web/dist/js/115.e1c.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/js/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9283746

Please sign in to comment.