2019-10-08 00:44:37 +03:00
|
|
|
[![License](https://img.shields.io/static/v1?label=License&message=MIT&color=2ec352&labelColor=2c3239)](https://github.com/luna/basegl/blob/master/LICENSE) [![Actions Status](https://github.com/luna/basegl/workflows/Build%20%28MacOS%2C%20Linux%2C%20Windows%29/badge.svg)](https://github.com/luna/basegl/actions) [![Coverage](https://img.shields.io/codecov/c/github/luna/basegl?label=Coverage&labelColor=2c3239)](https://codecov.io/gh/luna/basegl/branch/master)
|
2019-10-07 16:44:57 +03:00
|
|
|
![Stability](https://img.shields.io/static/v1?label=Stability&message=Unstable&color=d52229&labelColor=2c3239)
|
2019-10-07 14:51:18 +03:00
|
|
|
|
2019-10-08 06:25:29 +03:00
|
|
|
# BaseGL
|
|
|
|
|
2019-10-06 22:47:17 +03:00
|
|
|
BaseGL is a blazing fast 2D drawing API. This repository is a work in progress
|
|
|
|
of BaseGL 2.0. Please refer to BaseGL 1.0 repository for more information:
|
|
|
|
https://github.com/luna/basegl-old.
|
|
|
|
|
2019-10-08 07:00:00 +03:00
|
|
|
## Working with the code
|
2019-10-06 22:47:17 +03:00
|
|
|
|
2019-10-08 07:00:00 +03:00
|
|
|
### The Rust toolchain
|
2019-10-06 22:47:17 +03:00
|
|
|
|
|
|
|
In order to use some of the WASM pipeline features we need to use a nightly Rust
|
|
|
|
channel. The same applies to the code auto-formatter and it's advanced
|
|
|
|
configuration options used here. You would neither be able to compile not format
|
|
|
|
the code using the stable branch.
|
|
|
|
|
|
|
|
To setup the toolchain, please use the [the Rust toolchain installer
|
|
|
|
](https://rustup.rs/):
|
|
|
|
|
|
|
|
```bash
|
2019-11-18 18:56:26 +03:00
|
|
|
rustup toolchain install nightly-2019-11-04 # Install the nightly channel.
|
2019-10-07 21:01:12 +03:00
|
|
|
rustup default nightly # Set it as the default one.
|
|
|
|
rustup component add rustfmt # Install the code auto-formatter.
|
|
|
|
rustup component add clippy # Install the linter.
|
2019-10-06 22:47:17 +03:00
|
|
|
```
|
|
|
|
|
2019-10-08 07:00:00 +03:00
|
|
|
### Building and testing the project
|
2019-10-06 22:47:17 +03:00
|
|
|
|
2019-10-07 23:53:53 +03:00
|
|
|
Please use the `script/build.sh`, `script/watch.sh`, and `script/lint.sh`
|
|
|
|
scripts to build, watch, and lint the project respectively. We need to use a
|
|
|
|
simple custom wrappers here because of the several Rust toolchain issues:
|
2019-10-06 22:47:17 +03:00
|
|
|
|
|
|
|
- [No direct support for Cargo Workspaces in
|
2019-10-07 23:53:53 +03:00
|
|
|
wasm-pack.](https://github.com/rustwasm/wasm-pack/issues/642). Fixed in
|
|
|
|
`build.sh`.
|
2019-10-06 22:47:17 +03:00
|
|
|
- There is no watch utility in wasm-pack, which makes using it harder than it
|
2019-10-07 23:53:53 +03:00
|
|
|
should be. Fixed in `watch.sh`.
|
|
|
|
- [The commands cargo-check and cargo-clippy do not clean local cache if used
|
|
|
|
several times.](https://github.com/rust-lang/cargo/issues/6986). Fixed in
|
|
|
|
`lint.sh`.
|
2019-10-06 22:47:17 +03:00
|
|
|
|
2019-10-07 23:53:53 +03:00
|
|
|
In order to build an example demo scene, please use the following commands:
|
2019-10-06 22:47:17 +03:00
|
|
|
|
|
|
|
```bash
|
2019-10-07 23:53:53 +03:00
|
|
|
./script/watch.sh # Build and watch for changes.
|
2019-10-06 22:47:17 +03:00
|
|
|
|
|
|
|
# Wait till the project finishes building.
|
2019-10-07 23:53:53 +03:00
|
|
|
# Run the following lines from other cmd:
|
2019-10-06 22:47:17 +03:00
|
|
|
|
|
|
|
cd examples/01-scene
|
|
|
|
npm install
|
|
|
|
npm run start
|
|
|
|
```
|
|
|
|
|
|
|
|
You can now open the following address in your browser: http://localhost:8080.
|
|
|
|
**Please remember to disable the cache in your browser!**
|
|
|
|
|
2019-10-08 07:00:00 +03:00
|
|
|
### Working with the source code
|
2019-10-06 22:56:53 +03:00
|
|
|
|
2019-10-08 07:00:00 +03:00
|
|
|
#### Formatting
|
2019-10-06 22:47:17 +03:00
|
|
|
|
|
|
|
All codebase should be auto-formatted using `rustfmt`. It is highly recommended
|
|
|
|
that you use an IDE which takes care of formatting the code as you type. Please
|
|
|
|
remember that auto-formatting does not mean you should not care of the way your
|
|
|
|
code looks and feels! Be sure to carefully read the [Rust style
|
|
|
|
guide](https://github.com/luna/enso/blob/master/doc/rust-style-guide.md) and
|
|
|
|
apply it everywhere in your codebase.
|
|
|
|
|
|
|
|
|
2019-10-08 07:00:00 +03:00
|
|
|
#### Linting
|
2019-10-06 22:47:17 +03:00
|
|
|
|
|
|
|
Please be sure to fix all errors reported by `cargo clippy` before creating a
|
2019-10-06 22:56:53 +03:00
|
|
|
pull request to this repository.
|