task 16: addressing sejo's feedback
I'm still not quite happy with this..
This commit is contained in:
parent
3ca102f015
commit
d7389e15a8
|
@ -609,14 +609,14 @@ for a really complex example of this sort of _procedural graphics_.
|
|||
|
||||
## Task 16: a simple app
|
||||
|
||||
We now know how to read keys from keyboard and draw on the screen. Look at
|
||||
We now know how to read keys from keyboard and draw on the screen. Try out
|
||||
[tutorial/counter.mu](https://github.com/akkartik/mu/blob/main/tutorial/counter.mu)
|
||||
which implements a simple counter app.
|
||||
|
||||
<img alt='screenshot of the counter app' src='counter.png'>
|
||||
|
||||
Do all the parts make sense? Read the extensive vocabulary of functions for
|
||||
[drawing text to screen](https://github.com/akkartik/mu/blob/main/vocabulary.md#printing-to-screen).
|
||||
Now look at its code. Do all the parts make sense? Reread the extensive
|
||||
vocabulary of functions for [drawing text to screen](https://github.com/akkartik/mu/blob/main/vocabulary.md#printing-to-screen).
|
||||
|
||||
---
|
||||
|
||||
|
|
|
@ -43,6 +43,10 @@ how they work under the hood.
|
|||
- Code-points: integer representing a Unicode character. Must be representable
|
||||
in 32 bits as utf-8; largest supported value is 0x10000.
|
||||
|
||||
Mu will let you convert between bytes, graphemes and code-points using `copy`,
|
||||
and trust that you know what you're doing. Be aware that doing so is only
|
||||
correct for English/Latin characters, digits and symbols.
|
||||
|
||||
### Functions
|
||||
|
||||
The most useful functions from 400.mu and later .mu files. Look in
|
||||
|
@ -133,7 +137,7 @@ signatures.mu for their full type signatures.
|
|||
- `parse-decimal-int-from-slice`
|
||||
- `parse-decimal-int-from-stream`
|
||||
- `parse-array-of-decimal-ints`
|
||||
- `decimal-digit?`: checks if byte is in [0, 9]
|
||||
- `decimal-digit?`: checks if a grapheme is in [0, 9]
|
||||
|
||||
#### printing to screen
|
||||
|
||||
|
@ -250,7 +254,8 @@ Assertions for tests:
|
|||
#### events
|
||||
|
||||
`read-key` reads a single key from the keyboard and returns it if it exists.
|
||||
Returns 0 if no key has been pressed.
|
||||
Returns 0 if no key has been pressed. Currently only support single-byte keys,
|
||||
which are identical to their code-point and grapheme representations.
|
||||
|
||||
`read-line-from-keyboard` reads keys from keyboard, echoes them to screen
|
||||
(with given fg/bg colors) and accumulates them in a stream until it encounters
|
||||
|
|
Loading…
Reference in New Issue