mirror of
https://github.com/He4eT/cheap-glkote.git
synced 2026-05-05 08:57:25 +00:00
Update README.md
This commit is contained in:
parent
30f79c60b4
commit
c44c2f4f70
1 changed files with 19 additions and 9 deletions
28
README.md
28
README.md
|
|
@ -6,7 +6,11 @@ Can be used in Node.js or in a web browser.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
This repository includes examples of [stdio interface implementation](https://github.com/He4eT/cheap-glkote/blob/master/src/stdio.js) and [integration with Emglken](https://github.com/He4eT/cheap-glkote/blob/master/tests/player.stdio.js).
|
This repository includes examples of [stdio interface implementation](https://github.com/He4eT/cheap-glkote/blob/master/src/stdio.js) and [integration with Emglken](https://github.com/He4eT/cheap-glkote/blob/master/tests/player.stdio.js).<br>
|
||||||
|
You can try this version with `npx`:
|
||||||
|
```
|
||||||
|
npx cheap-glkote path/to/storyfile
|
||||||
|
```
|
||||||
|
|
||||||
### Initialization
|
### Initialization
|
||||||
```js
|
```js
|
||||||
|
|
@ -15,8 +19,9 @@ const { glkInterface, sendFn } = CheapGlkOte(handlers [, loggers])
|
||||||
|
|
||||||
### Input
|
### Input
|
||||||
```js
|
```js
|
||||||
sendFn('open door')
|
sendFn('open door', windowObject)
|
||||||
```
|
```
|
||||||
|
You can received `windowObject` in `onUpdateWindows` handler.<br>
|
||||||
You should respect input type setted by `onUpdateInputs`.
|
You should respect input type setted by `onUpdateInputs`.
|
||||||
|
|
||||||
### Output and lifecycle
|
### Output and lifecycle
|
||||||
|
|
@ -27,14 +32,9 @@ const handlers = {
|
||||||
* It's time to prepare the user interface.
|
* It's time to prepare the user interface.
|
||||||
*/
|
*/
|
||||||
},
|
},
|
||||||
onExit: () => {
|
onUpdateWindows: windows => {
|
||||||
/**
|
/**
|
||||||
* Game is over.
|
* Game wants to change the number of windows.
|
||||||
*/
|
|
||||||
},
|
|
||||||
onUpdateContent: messages => {
|
|
||||||
/**
|
|
||||||
* Process the game output here.
|
|
||||||
*/
|
*/
|
||||||
},
|
},
|
||||||
onUpdateInputs: type => {
|
onUpdateInputs: type => {
|
||||||
|
|
@ -43,6 +43,11 @@ const handlers = {
|
||||||
* Supported types: 'char', 'line'.
|
* Supported types: 'char', 'line'.
|
||||||
*/
|
*/
|
||||||
},
|
},
|
||||||
|
onUpdateContent: messages => {
|
||||||
|
/**
|
||||||
|
* Process the game output here.
|
||||||
|
*/
|
||||||
|
},
|
||||||
onDisable: () => {
|
onDisable: () => {
|
||||||
/**
|
/**
|
||||||
* Game wants to disable user interface.
|
* Game wants to disable user interface.
|
||||||
|
|
@ -66,6 +71,11 @@ const handlers = {
|
||||||
/**
|
/**
|
||||||
* Game wants to write the contents in the file.
|
* Game wants to write the contents in the file.
|
||||||
*/
|
*/
|
||||||
|
},
|
||||||
|
onExit: () => {
|
||||||
|
/**
|
||||||
|
* Game is over.
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue