pebble-engine 2.3.0

A modular, ECS-style graphics/app framework for Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Running on the Web

Pebble builds for `wasm32-unknown-unknown` — `WindowPlugin`'s runner and the whole rendering pipeline are written to work unmodified on both native and web. A few things differ:

- **The canvas is inserted automatically.** `winit` doesn't do this on its own; `WindowPlugin` asks it to (`with_append(true)`) so a window actually shows up in the page without hand-rolled DOM code.
- **The event loop is non-blocking.** Natively, `winit`'s `run` blocks forever; on wasm it uses `EventLoopExtWebSys::spawn`, which registers the loop with the browser and returns immediately. This is handled inside `WindowPlugin` — you don't need to branch on it yourself.
- **The default headless loop busy-polls instead of sleeping.** There's no real OS thread to sleep on wasm, so if you never register a windowing plugin (uncommon), the fallback loop just spins. In practice this path is only reached before a windowing plugin's runner takes over.
- **No `ADDRESS_MODE_CLAMP_TO_BORDER`.** The GPU backend requests this feature only on native; `SamplerKind::NearestClampBorder` falls back to clamp-to-edge on wasm accordingly.

Building:

```sh
cargo build --target wasm32-unknown-unknown
```

You'll still need your own bundling/serving setup (`wasm-bindgen`, `trunk`, or similar) — pebble doesn't ship one.