Skip to content

Commit 0f7cc0a

Browse files
authored
doc: proofreading (#134)
* doc: proofreading * add license in README.md
1 parent df5f640 commit 0f7cc0a

File tree

1 file changed

+43
-41
lines changed

1 file changed

+43
-41
lines changed

README.md

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
# <img style="vertical-align:middle;margin-right:10px;" width="100" alt="Calm" src="docs/images/calm.png"> Canvas Aided Lisp Magic
1+
# <img style="vertical-align:middle;margin-right:10px;" width="100" alt="Calm" src="docs/images/calm.png"> C A L M
22

33
[![CI](https://github.com/VitoVan/calm/actions/workflows/calm.yml/badge.svg)](https://github.com/VitoVan/calm/actions/workflows/calm.yml) [![GitHub all releases](https://img.shields.io/github/downloads/vitovan/calm/total?color=brightgreen&label=Downloads&style=flat)](#pre-built-binary) [![GitHub release (release name instead of tag name)](https://img.shields.io/github/v/release/vitovan/calm?label=Latest&color=%23005896)](https://github.com/VitoVan/calm/releases/latest)
44

5-
A Lisp development environment that enables you to build and distribute canvas based applications as Linux AppImage, macOS Application Bundle, Windows Installer and Web Application.
6-
7-
CALM down and draw something, in Lisp.
5+
**C**anvas **A**ided **L**isp **M**agic: Create canvas-based applications with Lisp and distribute them on Linux, macOS, Windows, and the web.
86

97
## Hello World
108

11-
Find whatever directory, create a file: **canvas.lisp**
9+
Find whatever directory, and create a file: **canvas.lisp**
1210

1311
```lisp
1412
(defparameter *color-list* '((0.83 0.82 0.84) (0.89 0.12 0.17) (0.94 0.87 0.47) (0 0.35 0.59)))
@@ -20,7 +18,7 @@ Find whatever directory, create a file: **canvas.lisp**
2018
(c:fill-path)))
2119
```
2220

23-
Launch your terminal, cd to that directory, enter the command:
21+
Launch your terminal, cd to that directory, and enter the command:
2422

2523
```bash
2624
calm
@@ -31,14 +29,14 @@ calm
3129
## Examples
3230

3331
<p align="center">
34-
<a href="https://vitovan.com/calm/examples-0.1.3/fan/calm.html"><img width="250" alt="Fan" src="./docs/examples/fan/canvas.png"></a>
35-
<a href="https://vitovan.com/calm/examples-0.1.3/mondrian/calm.html"><img width="250" alt="Mondrian" src="./docs/examples/mondrian/canvas.png"></a>
36-
<a href="https://vitovan.com/calm/examples-0.1.3/meditator/calm.html"><img width="250" alt="Meditator" src="./docs/examples/meditator/canvas.png"></a>
32+
<a href="https://vitovan.com/calm/1.0.1/fan/calm.html"><img width="250" alt="Fan" src="./docs/examples/fan/canvas.png"></a>
33+
<a href="https://vitovan.com/calm/1.0.1/mondrian/calm.html"><img width="250" alt="Mondrian" src="./docs/examples/mondrian/canvas.png"></a>
34+
<a href="https://vitovan.com/calm/1.0.1/meditator/calm.html"><img width="250" alt="Meditator" src="./docs/examples/meditator/canvas.png"></a>
3735
</p>
3836

39-
Source files and binaries for the above examples are [here](https://github.com/VitoVan/calm/tree/main/docs/examples) and [here](https://github.com/VitoVan/calm/releases/tag/examples-0.1.3).
37+
Source files and binaries for the above examples are [here](https://github.com/VitoVan/calm/tree/main/docs/examples) and [here](https://github.com/VitoVan/calm/releases/tag/1.0.1).
4038

41-
For more applications made with CALM, please check: [Made with CALM](https://github.com/VitoVan/made-with-calm).
39+
For more applications made with CALM, please check [Made with CALM](https://github.com/VitoVan/made-with-calm).
4240

4341
## <img style="vertical-align:middle;margin-right:5px;" width="50" alt="Calm Installer" src="./docs/images/calm.png"> Installation
4442

@@ -86,7 +84,7 @@ This command will generate different packages on different platforms:
8684

8785
>**Note**
8886
>
89-
>DMG creation is powered by [create-dmg](https://github.com/create-dmg/create-dmg), will be installed by `brew install create-dmg` if it were not present. So if you don't have create-dmg, this will install create-dmg for you.
87+
>DMG creation is powered by [create-dmg](https://github.com/create-dmg/create-dmg) and will be installed by `brew install create-dmg` if it were not present. So if you don't have create-dmg, this will install create-dmg for you.
9088
>
9189
>And, if you don't have [Homebrew](https://brew.sh/), this will also install Homebrew for you.
9290
>
@@ -98,7 +96,7 @@ This command will generate different packages on different platforms:
9896

9997
> **Note**
10098
>
101-
> Installer creation is powered by [NSIS](https://nsis.sourceforge.io/), will be installed by `winget install nsis` if it were not present. So if you don't have NSIS (i.e., `makensis`) under your PATH, this will install NSIS for you.
99+
> Installer creation is powered by [NSIS](https://nsis.sourceforge.io/) and will be installed by `winget install nsis` if it were not present. So if you don't have NSIS (i.e., `makensis`) under your PATH, this will install NSIS for you.
102100
>
103101
> And, if you don't have [winget](https://github.com/microsoft/winget-cli) under your PATH, this will also install winget for you.
104102
>
@@ -116,7 +114,7 @@ For more, please refer to the [Command Reference](#command-reference).
116114

117115
# CALM - References
118116

119-
From CALM 1.0.0, the version number will follow [Semantic Versioning Specification](https://semver.org/spec/v2.0.0.html). This means you can use CALM calmly without worrying me being crazy. Because whenever I'm going to be crazy, I will let you know [before anything got changed](https://semver.org/spec/v2.0.0.html#spec-item-7) and bump the major version if [anything could surprise](https://semver.org/spec/v2.0.0.html#spec-item-8) you.
117+
From CALM 1.0.0, the version number will follow [Semantic Versioning Specification](https://semver.org/spec/v2.0.0.html). This means you can use CALM calmly without worrying about me being crazy. Because whenever I'm going to be crazy, I will let you know [before anything got changed](https://semver.org/spec/v2.0.0.html#spec-item-7) and bump the major version if [anything could surprise](https://semver.org/spec/v2.0.0.html#spec-item-8) you.
120118

121119
Keep CALM and have fun.
122120

@@ -126,9 +124,9 @@ Keep CALM and have fun.
126124

127125
You should run this command inside your project directory, where the file **canvas.lisp** should exist.
128126

129-
This command will load **canvas.lisp** and show a window according to the instructions of the function `draw` or `draw-forever`. The file **canvas.lisp** is just a regular Lisp source file, you do what ever you like in it.
127+
This command will load **canvas.lisp** and show a window according to the instructions of the function `draw` or `draw-forever`. The file **canvas.lisp** is just a regular Lisp source file, you do whatever you like in it.
130128

131-
For CALM related functions and parameters, please refer to the [API Reference](#api-reference).
129+
For CALM-related functions and parameters, please refer to the [API Reference](#api-reference).
132130

133131
### `calm hello`
134132

@@ -150,7 +148,7 @@ You will have the following files and directories created:
150148
└── fonts.conf
151149
```
152150

153-
Files put into **assets** and **fonts** directory will be packed with your application during distribution. If you put your favourite font into **fonts** directory, you will be able to use it inside your application.
151+
Files put into **assets** and **fonts** directories will be packed with your application during distribution. If you put your favorite font into the **fonts** directory, you will be able to use it inside your application.
154152

155153
For more about font usage, please refer to the [API Reference](#api-reference).
156154

@@ -162,13 +160,13 @@ This command will generate:
162160
- macOS Application Bundle inside DMG
163161
- Windows Application Installer
164162

165-
according to the platform it were running on.
163+
according to the platform it was running on.
166164

167165
It does not take any arguments, but some options could be set through the environment variables, please check `calm publish-with-options` for the option details.
168166

169167
### `calm publish-with-options`
170168

171-
This command will do the same thing as `calm publish`, instead it will ask your opinions on all the customisable options (with a default value provided, don't worry), respectively:
169+
This command will do the same thing as `calm publish`, instead it will ask your opinions on all the customizable options (with a default value provided, don't worry), respectively:
172170

173171
| OS | ENV | Description |
174172
| ---------------- | -------------------- | ------------------------------------------------------------ |
@@ -187,7 +185,7 @@ If you have provided the corresponding environment variable, the option will not
187185

188186
### `calm publish-web`
189187

190-
This command will generate a **web** directory containing all the necessary materials for you to serve it on the internet. The common usage could be like:
188+
This command will generate a **web** directory containing all the necessary materials for you to serve it on the internet. The common usage could be like this:
191189

192190
```bash
193191
cd my-cool-app
@@ -224,14 +222,14 @@ This command works like `calm publish-with-options` except it's for `calm publis
224222

225223
| ENV | Description |
226224
| -------------------- | ------------------------------------------------------------ |
227-
| LISP_FILES | Code like `(load "shape.lisp")` may cause problem for the web application, since JSCL will try to load that file via HTTP requests. <br/>If you need to include the extra files other than **canvas.lisp**, please modify your code to bypass JSCL, for example: `#-jscl (load "shape.lisp")` and then set this option, such as: `("/abs/path/to/canvas.lisp" "/abs/path/to/shape.lisp")`. Please remember to escape the double quotes if you're going to set the ENV. |
228-
| REBUILD_WASM_P | By default WebAssembly files were not built locally, they were downloaded from the [CALM Releases](https://github.com/VitoVan/calm/releases/): **calm.tar**. This prebuilt WebAssembly binary bundled with [OpenSan-Regular.ttf](https://github.com/googlefonts/opensans/raw/main/fonts/ttf/OpenSans-Regular.ttf) and [exposed all the Cairo and SDL2 APIs](https://github.com/VitoVan/calm/blob/main/s/usr/web/wasm.lisp#L61) mentioned in the below [API Reference](#api-reference) section.<br/> If you need to bundle other **fonts** or **assets**, or you need expose more C APIs be exposed to the web, please set this option to "yes". <br/>Caution: Building WebAssembly binaries involves a whole lot of dependencies, to simplify this progress, I irresponsibly utilised docker. So, please make sure you have the `docker` command at your disposal.<br/>Default: "no" |
225+
| LISP_FILES | Code like `(load "shape.lisp")` may cause problems for the web application, since JSCL will try to load that file via HTTP requests. <br/>If you need to include the extra files other than **canvas.lisp**, please modify your code to bypass JSCL, for example: `#-jscl (load "shape.lisp")` and then set this option, such as: `("/abs/path/to/canvas.lisp" "/abs/path/to/shape.lisp")`. Please remember to escape the double quotes if you're going to set the ENV. |
226+
| REBUILD_WASM_P | By default WebAssembly files were not built locally, they were downloaded from the [CALM Releases](https://github.com/VitoVan/calm/releases/): **calm.tar**. This prebuilt WebAssembly binary bundled with [OpenSan-Regular.ttf](https://github.com/googlefonts/opensans/raw/main/fonts/ttf/OpenSans-Regular.ttf) and [exposed all the Cairo and SDL2 APIs](https://github.com/VitoVan/calm/blob/main/s/usr/web/wasm.lisp#L61) mentioned in the below [API Reference](#api-reference) section.<br/> If you need to bundle other **fonts** or **assets**, or you need to expose more C APIs be exposed to the web, please set this option to "yes". <br/>Caution: Building WebAssembly binaries involves a whole lot of dependencies, to simplify this progress, I irresponsibly utilized docker. So, please make sure you have the `docker` command at your disposal.<br/>Default: "no" |
229227

230228
Since JSCL is the backbone of CALM on the web, any change of JSCL will be considered as a change of CALM itself. The code base of JSCL used by each version of CALM is fixed, it won't change unless you update CALM. Please feel safe to use it.
231229

232230
### API Reference
233231

234-
CALM intended to be a thin layer above [SDL2](https://wiki.libsdl.org/SDL2/FrontPage), [Cairo](https://www.cairographics.org/) and some other things. So the number of APIs provided by CALM is intended to be as small as possible.
232+
CALM is intended to be a thin layer above [SDL2](https://wiki.libsdl.org/SDL2/FrontPage), [Cairo](https://www.cairographics.org/), and some other things. So the number of APIs provided by CALM is intended to be as small as possible.
235233

236234
#### Fundamentals
237235

@@ -250,15 +248,15 @@ This is the entry function for a CALM application, it will be called once the ap
250248
(c:fill-path))
251249
```
252250

253-
This function will be called passivly. That is to say, this function won't be called again after the first call, unless any event has been triggered by the user, such as: mouse motion, keydown, keyup, mousebuttondown, etc.
251+
This function will be called passively. That is to say, this function won't be called again after the first call, unless any event has been triggered by the user, such as mouse motion, key down, key up, mouse button down, etc.
254252

255253
If you want to continually refresh the canvas without user interaction, you should use `draw-forever`.
256254

257-
Note: Functions like `c:arc` are third party APIs exposed by CALM. Please refer to [Drawing on Canvas](#drawing-on-canvas) for more info.
255+
Note: Functions like `c:arc` are third-party APIs exposed by CALM. Please refer to [Drawing on Canvas](#drawing-on-canvas) for more info.
258256

259257
#### Function `draw-forever`
260258

261-
This is also the entry function for a CALM application, just like `draw`, so please DON NOT define both of them, the consequence of having both `draw` and `draw-forever` is equivalent to killing John Wick's dog.
259+
This function also serves as the entry point for a CALM application, similar to the `draw` function. It is important to avoid defining both `draw` and `draw-forever` as doing so would have severe consequences, comparable to killing John Wick's dog.
262260

263261
This function will be called every `*calm-delay*` milliseconds, regardless of user interaction.
264262

@@ -268,15 +266,15 @@ This variable controls how many milliseconds CALM should wait before refreshing
268266

269267
Default: 42
270268

271-
This variable only works on desktop, for web platform, please check `*calm-fps*`.
269+
This variable only works on the desktop platform, for the web platform, please check `*calm-fps*`.
272270

273271
#### Variable `*calm-fps*`
274272

275273
This variable controls how many milliseconds CALM should wait before refreshing the canvas. Setting 0 will use the browser’s `requestAnimationFrame` mechanism to refresh the canvas.
276274

277275
Default: 42
278276

279-
This variable only works on the web, for desktop platform, please check `*calm-delay*`.
277+
This variable only works on the web, for the desktop platform, please check `*calm-delay*`.
280278

281279
#### Drawing on Canvas
282280

@@ -304,7 +302,7 @@ is equivalent to
304302

305303
All the symbols [exported by cl-cairo2](https://github.com/rpav/cl-cairo2/blob/master/src/package.lisp#L7-L142) should be accessible through `c:` prefix, such as: `c:arc`. On the web, the accessible symbols are limited by [cairo.lisp](https://github.com/VitoVan/calm/blob/main/src/web/cairo.lisp#L266-L405).
306304

307-
Since Cairo is the cardinal drawing facility of CALM, any change of Cairo related symbols will be considered as a change of CALM itself. Please feel safe to use them.
305+
Since Cairo is the cardinal drawing facility of CALM, any change of Cairo-related symbols will be considered as a change of CALM itself. Please feel safe to use them.
308306

309307
#### Function `c:rrectangle`
310308

@@ -359,7 +357,7 @@ This function is not exposed to the web due to the following reasons:
359357

360358
1. Pango requires multi-threading, which requires extra [HTTP HEADERS](https://web.dev/coop-coep/) to be set
361359
2. Compiling Pango into WebAssembly will increase the time and data for loading
362-
3. Using Pango often involves extra fonts to be bundle, this will cause more data to be loaded
360+
3. Using Pango often involves extra fonts to be bundled, this will cause more data to be loaded
363361

364362
So I don't think this is a good idea to include Pango by default, albeit it is easy to implement.
365363

@@ -369,7 +367,7 @@ So I don't think this is a good idea to include Pango by default, albeit it is e
369367

370368
Play a wav file.
371369

372-
If `c:play-wav` were called before, and the previous wav file were still playing, the sound will be merged together.
370+
If `c:play-wav` were called before, and the previous wav file was still playing, the sound will be merged together.
373371

374372
```lisp
375373
(c:play-wav "assets/ouch.ogg" :loops 0 :channel -1)
@@ -395,7 +393,7 @@ Set the volume of `c:play-wav`.
395393
(c:volume-wav 128 :channel -1)
396394
```
397395

398-
The value should between 0 (silence) and 128.
396+
The value should be between 0 (silence) and 128.
399397

400398
Set `:channel` to -1 means all channels.
401399

@@ -411,15 +409,15 @@ Set `:channel` to -1 means all channels.
411409

412410
#### Function `c:play-music`
413411

414-
Play a music file, it is able to play MP3, Ogg, and WAV.
412+
Play a music file, it can play MP3, Ogg, and WAV.
415413

416414
Other types of files might also work, but they are not guaranteed by CALM.
417415

418416
```lisp
419417
(c:play-music "assets/bgm.ogg" :loops 0)
420418
```
421419

422-
If `c:play-music` were called before, and the previous music were still playing, it will be stopped and the latest music will start playing.
420+
If `c:play-music` were called before, and the previous music was still playing, it will be stopped and the latest music will start playing.
423421

424422
#### Function `c:volume-music`
425423

@@ -429,21 +427,21 @@ Set the volume of `c:play-music`.
429427
(c:volume-music 128)
430428
```
431429

432-
The value should between 0 (silence) and 128.
430+
The value should be between 0 (silence) and 128.
433431

434432
#### Function `c:halt-music`
435433

436434
Stop playing music.
437435

438436
#### Function `c:play-audio`
439437

440-
Play an audio file, this function is only available on the web, since it utilise the [HTMLAudioElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement).
438+
Play an audio file, this function is only available on the web since it utilizes the [HTMLAudioElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement).
441439

442440
```lisp
443441
(c:play-audio "assets/meow.ogg" :loop-audio-p nil :volume 1)
444442
```
445443

446-
`:volume` should between 0 and 1.
444+
`:volume` should be between 0 and 1.
447445

448446
#### Function `c:halt-audio`
449447

@@ -474,15 +472,15 @@ If call it without any arguments, it stops all the playing audio.
474472

475473
#### Variable `*calm-state-finger-just-tapped*`
476474

477-
The above variables hold the state of mouse and finger (touch device, like the mobile web browser), they are readonly. The consequence of `(setf *calm-state-mouse-x* 20)` is equivalent to drinking bleach.
475+
The above variables hold the state of the mouse and finger (touch device, like the mobile web browser), they are read-only. The consequence of `(setf *calm-state-mouse-x* 20)` is equivalent to drinking bleach.
478476

479477
#### Function `c:get-ticks`
480478

481479
This is just [SDL_GetTicks](https://wiki.libsdl.org/SDL2/SDL_GetTicks).
482480

483481
#### Event Callbacks
484482

485-
These callbacks are functions that you should define. If you defined any of them, they will be called when the corresponding event being triggered.
483+
These callbacks are functions that you should define. If you defined any of them, they will be called when the corresponding event was triggered.
486484

487485
#### Callback `on-keydown`
488486

@@ -492,7 +490,7 @@ You know what these callbacks do, what you don't know is their should-be argumen
492490

493491
#### Function `c:keq`
494492

495-
This function compares the first argument with a infinite number of SDL2 Scancodes, if any of them matched, it will return `T`.
493+
This function compares the first argument with an infinite number of SDL2 Scancodes, if any of them matched, it will return `T`.
496494

497495
```lisp
498496
(defun on-keyup (key) ;; keyup handler for evil vimers
@@ -572,7 +570,7 @@ SDL2 Scancode: https://wiki.libsdl.org/SDL2/SDL_Scancode
572570

573571
#### Callback `on-windowleave`
574572

575-
These two callbacks does not take any arguments, for example:
573+
These two callbacks do not take any arguments, for example:
576574

577575
```lisp
578576
(defun on-windowenter ()
@@ -629,3 +627,7 @@ You could check these useful links while waiting:
629627
- https://lispcookbook.github.io/cl-cookbook/
630628
- http://www.lispworks.com/documentation/HyperSpec/Front/
631629
- https://lisp-lang.org/books/
630+
631+
## License
632+
633+
The [souece code](https://github.com/VitoVan/calm) is released under GPL-2.0-only.

0 commit comments

Comments
 (0)