Embedded Graphics Web Simulator
The web simulator is based on embedded-graphics-simulator.
This is a sample project demonstrating using a no_std
rust-embedded library with Webassembly.
The Web Simulator allows you to use a browser to test embedded-graphics code and run graphics. There is no need to install SDL and its development libraries for running the project. You can see the demo here.
For Development
This library is intended to be used in Rust + Webassembly projects. Check the examples which illustrate how to use the library. Look at the examples in the Embedded Graphics Simulator project for inspiration. You can use wasm-pack or trunkand add this library as a dependency
Usage example:
use ;
use *;
use console;
use ;
use Bmp;
// When the `wee_alloc` feature is enabled, this uses `wee_alloc` as the global
// allocator.
//
// If you don't want to use `wee_alloc`, you can safely delete this.
static ALLOC: WeeAlloc = INIT;
// This is like the `main` function, except for JavaScript.
How it works
Embedded Graphics Web Simulator implements DrawTarget
for the HTML <canvas>
element.
It will attach a <canvas>
either to the document body, or to a user-supplied parent element.
To minimize overhead, draw operations need to be explicitly flush()
ed whenver you want to see an actual update.
Credits
This project is based on the embedded-graphics library, originally by @jamwaffles
Tools
Thanks to all contributors :)