Show More
@@ -1,44 +1,44 b'' | |||||
1 | (инструкции на Русском - внизу) |
|
1 | (инструкции на Русском - внизу) | |
2 |
|
2 | |||
3 | # txt2web |
|
3 | # txt2web | |
4 | Compiler for QSP games which creates monolithic HTML pages. |
|
4 | Compiler for QSP games which creates monolithic HTML pages. | |
5 |
|
5 | |||
6 | ## Usage |
|
6 | ## Usage | |
7 |
|
7 | |||
8 | There are three mastery levels |
|
8 | There are three mastery levels | |
9 |
|
9 | |||
10 | 1. Just build me the game:<br/> |
|
10 | 1. Just build me the game:<br/> | |
11 | `txt2web game.txt`<br/> |
|
11 | `txt2web game.txt`<br/> | |
12 | And it will create the game in game.html |
|
12 | And it will create the game in game.html | |
13 |
|
13 | |||
14 | 2. I know what I'm doing:<br/> |
|
14 | 2. I know what I'm doing:<br/> | |
15 | `txt2web game.txt -o game.html --body body.html --js jquery.js my-js-library.js --css styles/*.css`<br/> |
|
15 | `txt2web game.txt -o game.html --body body.html --js jquery.js my-js-library.js --css styles/*.css`<br/> | |
16 | All options are self-explanatory. The result is a monolithic html specified |
|
16 | All options are self-explanatory. The result is a monolithic html specified | |
17 | with the `-o` option. Default `body.html` (used by the first mastery level) can |
|
17 | with the `-o` option. Default `body.html` (used by the first mastery level) can | |
18 | be found in `extas` directory. |
|
18 | be found in `extas` directory. | |
19 |
|
19 | |||
20 | 3. I'm a frontend developer!<br/> |
|
20 | 3. I'm a frontend developer!<br/> | |
21 | `txt2web game.txt -c -o game.js`<br/> |
|
21 | `txt2web game.txt -c -o game.js`<br/> | |
22 | It just builds the game script into a js you can put on your website. To run |
|
22 | It just builds the game script into a js you can put on your website. To run | |
23 |
the game execute ` |
|
23 | the game execute `qsp_start()` | |
24 |
|
24 | |||
25 | # txt2web |
|
25 | # txt2web | |
26 | Компилятор для игр на QSP создающий монолитные страницы на HTML. |
|
26 | Компилятор для игр на QSP создающий монолитные страницы на HTML. | |
27 |
|
27 | |||
28 | ## Инструкции |
|
28 | ## Инструкции | |
29 |
|
29 | |||
30 | Есть три уровня мастерства. |
|
30 | Есть три уровня мастерства. | |
31 |
|
31 | |||
32 | 1. **Просто собери мне игру**:<br/> |
|
32 | 1. **Просто собери мне игру**:<br/> | |
33 | `txt2web game.txt`<br/> |
|
33 | `txt2web game.txt`<br/> | |
34 | Создаст игру в game.html |
|
34 | Создаст игру в game.html | |
35 |
|
35 | |||
36 | 2. **Я знаю что делаю**:<br/> |
|
36 | 2. **Я знаю что делаю**:<br/> | |
37 | `txt2web game.txt -o game.html --body body.html --js jquery.js my-js-library.js --css styles/*.css`<br/> |
|
37 | `txt2web game.txt -o game.html --body body.html --js jquery.js my-js-library.js --css styles/*.css`<br/> | |
38 | Если вы знаете что делаете, то для вас смысл опций очевиден. `body.html` и `default.css` |
|
38 | Если вы знаете что делаете, то для вас смысл опций очевиден. `body.html` и `default.css` | |
39 | лежат в каталоге `extras`. |
|
39 | лежат в каталоге `extras`. | |
40 |
|
40 | |||
41 | 3. **Я - фронтендер!**<br/> |
|
41 | 3. **Я - фронтендер!**<br/> | |
42 | `txt2web game.txt -c -o game.js`<br/> |
|
42 | `txt2web game.txt -c -o game.js`<br/> | |
43 | Просто соберёт игру в Javascript файл который вы можете разместить на своём |
|
43 | Просто соберёт игру в Javascript файл который вы можете разместить на своём | |
44 | сайте как вам угодно. |
|
44 | сайте как вам угодно. Чтобы запустить игру: `qsp_start()` |
@@ -1,54 +1,56 b'' | |||||
1 |
|
1 | |||
2 | (in-package txt2web.main) |
|
2 | (in-package txt2web.main) | |
3 |
|
3 | |||
4 | ;;; Game session state (saved in savegames) |
|
4 | ;;; Game session state (saved in savegames) | |
5 | ;; Variables |
|
5 | ;; Variables | |
6 | (var *globals (create)) |
|
6 | (var *globals (create)) | |
7 | ;; Inventory (objects) |
|
7 | ;; Inventory (objects) | |
8 | (var *objs (create)) |
|
8 | (var *objs (create)) | |
9 | (var *current-location nil) |
|
9 | (var *current-location nil) | |
10 | ;; Game time |
|
10 | ;; Game time | |
11 | (var *started-at (chain *date (now))) |
|
11 | (var *started-at (chain *date (now))) | |
12 | ;; Timers |
|
12 | ;; Timers | |
13 | (var *timer-interval 500) |
|
13 | (var *timer-interval 500) | |
14 | (var *timer-obj nil) |
|
14 | (var *timer-obj nil) | |
15 | ;; Games |
|
15 | ;; Games | |
16 | (var *loaded-games (list)) |
|
16 | (var *loaded-games (list)) | |
17 |
|
17 | |||
18 | ;;; Transient state |
|
18 | ;;; Transient state | |
19 | ;; ACTions |
|
19 | ;; ACTions | |
20 | (var *acts (create)) |
|
20 | (var *acts (create)) | |
21 | ;; Savegame data |
|
21 | ;; Savegame data | |
22 | (var *state-stash (create)) |
|
22 | (var *state-stash (create)) | |
23 | ;; List of audio files being played |
|
23 | ;; List of audio files being played | |
24 | (var *playing (create)) |
|
24 | (var *playing (create)) | |
25 | ;; Local variables stack (starts with an empty frame) |
|
25 | ;; Local variables stack (starts with an empty frame) | |
26 | (var *locals (list)) |
|
26 | (var *locals (list)) | |
27 | ;; Promise to continue running the game after menu |
|
27 | ;; Promise to continue running the game after menu | |
28 | (var *menu-resume nil) |
|
28 | (var *menu-resume nil) | |
29 |
|
29 | |||
30 | ;;; Game data |
|
30 | ;;; Game data | |
31 | ;; Games (filename -> [locations]) |
|
31 | ;; Games (filename -> [locations]) | |
32 | (var *games (list)) |
|
32 | (var *games (list)) | |
33 | ;; The main (non library) game. Updated by openqst |
|
33 | ;; The main (non library) game. Updated by openqst | |
34 | (var *main-game nil) |
|
34 | (var *main-game nil) | |
35 | ;; Active locations |
|
35 | ;; Active locations | |
36 | (var *locs (create)) |
|
36 | (var *locs (create)) | |
37 |
|
37 | |||
38 | (setf (@ window onload) |
|
38 | (setf (@ window onload) | |
39 | (lambda () |
|
39 | #'start) | |
40 | (#.(intern "INIT-DOM" "TXT2WEB.API")) |
|
40 | ||
41 | ;; For MSECCOUNT |
|
41 | (defun start () | |
42 | (setf *started-at (chain *date (now))) |
|
42 | (#.(intern "INIT-DOM" "TXT2WEB.API")) | |
43 | ;; For $COUNTER and SETTIMER |
|
43 | ;; For MSECCOUNT | |
44 | (#.(intern "SET-TIMER" "TXT2WEB.API") |
|
44 | (setf *started-at (chain *date (now))) | |
45 | *timer-interval) |
|
45 | ;; For $COUNTER and SETTIMER | |
46 | ;; Start the first game |
|
46 | (#.(intern "SET-TIMER" "TXT2WEB.API") | |
47 | (#.(intern "RUN-GAME" "TXT2WEB.API") |
|
47 | *timer-interval) | |
48 | (chain *object (keys *games) 0)) |
|
48 | ;; Start the first game | |
49 | (values))) |
|
49 | (#.(intern "RUN-GAME" "TXT2WEB.API") | |
|
50 | (chain *object (keys *games) 0)) | |||
|
51 | (values)) | |||
50 |
|
52 | |||
51 | ;;; Some very common utilities (for both api and lib) |
|
53 | ;;; Some very common utilities (for both api and lib) | |
52 |
|
54 | |||
53 | (defun by-id (id) |
|
55 | (defun by-id (id) | |
54 | (chain document (get-element-by-id id))) |
|
56 | (chain document (get-element-by-id id))) |
General Comments 0
You need to be logged in to leave comments.
Login now