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