update documentation (unfinished)
This commit is contained in:
parent
9cb24a0b1e
commit
90101d7c7f
35
docs/haku.dj
35
docs/haku.dj
|
@ -1,13 +1,13 @@
|
|||
# haku
|
||||
|
||||
Haku is a little scripting language used by rakugaki for programming brushes.
|
||||
haku is a little scripting language used by rakugaki for programming brushes.
|
||||
Here's a brief tour of the language.
|
||||
|
||||
## Your brush
|
||||
|
||||
Your brush is a piece of code that describes what's to be drawn on the wall.
|
||||
|
||||
For example:
|
||||
For example, the default brush:
|
||||
|
||||
```haku
|
||||
(stroke
|
||||
|
@ -22,7 +22,7 @@ It demonstrates a few things:
|
|||
- The brush's task is to produce a description of what's to be drawn.
|
||||
Brushes produce *scribbles* - commands that instruct rakugaki draw something on the wall.
|
||||
|
||||
- This brush produces the `(stroke)` scribble.
|
||||
- This brush produces the `stroke` scribble.
|
||||
This scribble is composed out of three things:
|
||||
|
||||
- The stroke thickness - in this case `8`.
|
||||
|
@ -42,11 +42,38 @@ Brushes produce *scribbles* - commands that instruct rakugaki draw something on
|
|||
|
||||
I highly recommend that you play around with the brush to get a feel for editing haku code!
|
||||
|
||||
## More complicated brushes
|
||||
|
||||
To make our brush more complicated, we can make it produce _multiple_ scribbles instead of just one.
|
||||
To do that, we'll aggregate our scribbles into a _list_:
|
||||
|
||||
```haku
|
||||
(list
|
||||
(stroke 8 (rgba 0 0 1 1) (vec (- 4) 0))
|
||||
(stroke 8 (rgba 1 0 0 1) (vec 4 0)))
|
||||
```
|
||||
|
||||
A list allows us to say, "I'd like this brush to draw this, this, and this."
|
||||
Of course, we are not limited to two elements only:
|
||||
|
||||
```haku
|
||||
|
||||
```
|
||||
|
||||
## Limits
|
||||
|
||||
The wall is infinite, but your brush may only draw in a small area around your cursor (~500 pixels.)
|
||||
Drawing outside this area may result in pixels getting dropped in ugly ways, but it can also be used to your advantage in order to produce cool glitch art.
|
||||
|
||||
You can see this in action by setting the brush size to something really large:
|
||||
|
||||
```haku
|
||||
(stroke
|
||||
1000
|
||||
(rgba 0 0 0 1)
|
||||
(vec))
|
||||
```
|
||||
|
||||
Additionally, haku code has some pretty strong limitations on what it can do.
|
||||
It cannot be too big, it cannot execute for too long, and it cannot consume too much memory.
|
||||
It does not have access to the world outside the wall.
|
||||
It does not have access to the world outside the wall, so you cannot use it to fire network requests or read the user's input in uncontrolled ways.
|
||||
|
|
Loading…
Reference in a new issue