Skip to content

Commit d098e30

Browse files
authored
Update README.md (#231)
1 parent f6a9c4b commit d098e30

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ You can learn more about this project from this [talk at LibreGraphicsMeeting 20
99

1010
## Getting started
1111

12+
There is two different things at work here :
13+
- libprocessing (this repo) is the low-level cross-platform library for the core Processing API. It's written in Rust, and thus lets write Processing sketches in Rust.
14+
- mewnala is a Python package built directly from libprocessing, providing Python bindings for the library. It's available as any other Python package out there and lets you write Processing sketches in a Python environment, regardless of you having libprocessing or Rust installed.
15+
1216
### mewnala (the python library)
1317

1418
Inside of our `processing_pyo3` crate we have created a python package that you can easily install with pip.
@@ -28,21 +32,65 @@ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | ie
2832
```
2933

3034
#### Install a mewnala
35+
36+
We're going to create a folder named `mewnala-sketchbook` and install the `mewnala` package inside:
37+
3138
```bash
3239
# Initialize a project with uv
3340
uv init mewnala-sketchbook && cd mewnala-sketchbook
3441

3542
# add the package
3643
uv add mewnala
44+
```
45+
46+
Now create a file named `sketch.py` at the root of `mewnala-sketchbook`.
47+
48+
You can use this code to test
49+
50+
```python
51+
from mewnala import *
3752

53+
def setup():
54+
size(400, 400)
55+
background(255)
56+
57+
def draw():
58+
push_matrix()
59+
translate(mouse_x, mouse_y)
60+
fill(255, 100, 200)
61+
circle(0, 0, 50)
62+
pop_matrix()
63+
64+
run()
65+
```
66+
67+
Now run your sketch using:
68+
69+
```bash
3870
# run a sketch
3971
uv run sketch.py
4072
```
4173

74+
_Note: you can use any file name you want for your sketch_
75+
4276
### Rust (libprocessing)
4377

4478
You'll need to install the Rust toolchain to work on this project. Most users will want to install Rust via [`rustup`](https://rustup.rs/), which helps manage Rust toolchain versions.
4579

80+
### Clone the project and its submodules
81+
82+
When cloning this repo (or your fork), don't forget to install its submodules (eg. Lygia)
83+
84+
```bash
85+
git clone --recurse-submodules git@github.com:processing/libprocessing.git
86+
```
87+
88+
if you already cloned the repo without `--recurse-submodules`, you can run
89+
90+
```bash
91+
git submodule update --init
92+
```
93+
4694
### Build commands
4795

4896
This project uses [just](https://github.com/casey/just) as a command runner:
@@ -65,6 +113,12 @@ Install [wasm-pack](https://rustwasm.github.io/wasm-pack/):
65113
cargo install wasm-pack
66114
```
67115

116+
On Windows, you'll need to manually install `wasm-opt`
117+
118+
```bash
119+
cargo install wasm-opt
120+
```
121+
68122
You'll also need the wasm32 target:
69123

70124
```bash
@@ -84,6 +138,7 @@ This outputs the package to `target/wasm/`.
84138
```bash
85139
just wasm-serve
86140
```
141+
_Note: you'll need python installed on your machine to run this command_
87142

88143

89144
## Contributing

0 commit comments

Comments
 (0)