35 |
|
|
36 |
;; ;;;;;;;;;;;;; customization variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;;;;;;;;;;;;; customization variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
37 |
|
|
38 |
(defvar tetris-use-glyphs t |
(defgroup tetris nil |
39 |
"Non-nil means use glyphs when available.") |
"Play a game of tetris." |
40 |
|
:prefix "tetris-" |
41 |
|
:group 'games) |
42 |
|
|
43 |
|
(defcustom tetris-use-glyphs t |
44 |
|
"*Non-nil means use glyphs when available." |
45 |
|
:group 'tetris |
46 |
|
:type 'boolean) |
47 |
|
|
48 |
|
(defcustom tetris-use-color t |
49 |
|
"*Non-nil means use color when available." |
50 |
|
:group 'tetris |
51 |
|
:type 'boolean) |
52 |
|
|
53 |
|
(defcustom tetris-draw-border-with-glyphs t |
54 |
|
"*Non-nil means draw a border even when using glyphs." |
55 |
|
:group 'tetris |
56 |
|
:type 'boolean) |
57 |
|
|
58 |
|
(defcustom tetris-default-tick-period 0.3 |
59 |
|
"*The default time taken for a shape to drop one row." |
60 |
|
:group 'tetris |
61 |
|
:type 'number) |
62 |
|
|
63 |
(defvar tetris-use-color t |
(defcustom tetris-update-speed-function |
|
"Non-nil means use color when available.") |
|
|
|
|
|
(defvar tetris-draw-border-with-glyphs t |
|
|
"Non-nil means draw a border even when using glyphs.") |
|
|
|
|
|
(defvar tetris-default-tick-period 0.3 |
|
|
"The default time taken for a shape to drop one row.") |
|
|
|
|
|
(defvar tetris-update-speed-function |
|
64 |
'tetris-default-update-speed-function |
'tetris-default-update-speed-function |
65 |
"Function run whenever the Tetris score changes |
"Function run whenever the Tetris score changes |
66 |
Called with two arguments: (SHAPES ROWS) |
Called with two arguments: (SHAPES ROWS) |
67 |
SHAPES is the number of shapes which have been dropped |
SHAPES is the number of shapes which have been dropped |
68 |
ROWS is the number of rows which have been completed |
ROWS is the number of rows which have been completed |
69 |
|
|
70 |
If the return value is a number, it is used as the timer period.") |
If the return value is a number, it is used as the timer period." |
71 |
|
:group 'tetris |
72 |
|
:type 'function) |
73 |
|
|
74 |
|
(defcustom tetris-mode-hook nil |
75 |
|
"Hook run upon starting Tetris." |
76 |
|
:group 'tetris |
77 |
|
:type 'hook) |
78 |
|
|
79 |
(defvar tetris-mode-hook nil |
(defcustom tetris-tty-colors |
|
"Hook run upon starting Tetris.") |
|
|
|
|
|
(defvar tetris-tty-colors |
|
80 |
[nil "blue" "white" "yellow" "magenta" "cyan" "green" "red"] |
[nil "blue" "white" "yellow" "magenta" "cyan" "green" "red"] |
81 |
"Vector of colors of the various shapes in text mode |
"Vector of colors of the various shapes in text mode |
82 |
Element 0 is ignored.") |
Element 0 is ignored." |
83 |
|
:group 'tetris |
84 |
|
:type (let ((names `("Shape 1" "Shape 2" "Shape 3" |
85 |
|
"Shape 4" "Shape 5" "Shape 6" "Shape 7")) |
86 |
|
(result `(vector (const nil)))) |
87 |
|
(while names |
88 |
|
(add-to-list 'result |
89 |
|
(cons 'choice |
90 |
|
(cons :tag |
91 |
|
(cons (car names) |
92 |
|
(mapcar (lambda (color) |
93 |
|
(list 'const color)) |
94 |
|
(defined-colors))))) |
95 |
|
t) |
96 |
|
(setq names (cdr names))) |
97 |
|
result)) |
98 |
|
|
99 |
(defvar tetris-x-colors |
(defcustom tetris-x-colors |
100 |
[nil [0 0 1] [0.7 0 1] [1 1 0] [1 0 1] [0 1 1] [0 1 0] [1 0 0]] |
[nil [0 0 1] [0.7 0 1] [1 1 0] [1 0 1] [0 1 1] [0 1 0] [1 0 0]] |
101 |
"Vector of colors of the various shapes |
"Vector of colors of the various shapes |
102 |
Element 0 is ignored.") |
Element 0 is ignored." |
103 |
|
:group 'tetris |
104 |
(defvar tetris-buffer-name "*Tetris*" |
:type 'sexp) |
105 |
"Name used for Tetris buffer.") |
|
106 |
|
(defcustom tetris-buffer-name "*Tetris*" |
107 |
(defvar tetris-buffer-width 30 |
"Name used for Tetris buffer." |
108 |
"Width of used portion of buffer.") |
:group 'tetris |
109 |
|
:type 'string) |
110 |
(defvar tetris-buffer-height 22 |
|
111 |
"Height of used portion of buffer.") |
(defcustom tetris-buffer-width 30 |
112 |
|
"Width of used portion of buffer." |
113 |
(defvar tetris-width 10 |
:group 'tetris |
114 |
"Width of playing area.") |
:type 'number) |
115 |
|
|
116 |
(defvar tetris-height 20 |
(defcustom tetris-buffer-height 22 |
117 |
"Height of playing area.") |
"Height of used portion of buffer." |
118 |
|
:group 'tetris |
119 |
(defvar tetris-top-left-x 3 |
:type 'number) |
120 |
"X position of top left of playing area.") |
|
121 |
|
(defcustom tetris-width 10 |
122 |
(defvar tetris-top-left-y 1 |
"Width of playing area." |
123 |
"Y position of top left of playing area.") |
:group 'tetris |
124 |
|
:type 'number) |
125 |
|
|
126 |
|
(defcustom tetris-height 20 |
127 |
|
"Height of playing area." |
128 |
|
:group 'tetris |
129 |
|
:type 'number) |
130 |
|
|
131 |
|
(defcustom tetris-top-left-x 3 |
132 |
|
"X position of top left of playing area." |
133 |
|
:group 'tetris |
134 |
|
:type 'number) |
135 |
|
|
136 |
|
(defcustom tetris-top-left-y 1 |
137 |
|
"Y position of top left of playing area." |
138 |
|
:group 'tetris |
139 |
|
:type 'number) |
140 |
|
|
141 |
(defvar tetris-next-x (+ (* 2 tetris-top-left-x) tetris-width) |
(defvar tetris-next-x (+ (* 2 tetris-top-left-x) tetris-width) |
142 |
"X position of next shape.") |
"X position of next shape.") |