libtcod 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,225 @@
1
+ module TCOD
2
+ class Color
3
+ # default colors
4
+ # grey levels
5
+ BLACK=Color.rgb(0,0,0)
6
+ DARKEST_GREY=Color.rgb(31,31,31)
7
+ DARKER_GREY=Color.rgb(63,63,63)
8
+ DARK_GREY=Color.rgb(95,95,95)
9
+ GREY=Color.rgb(127,127,127)
10
+ LIGHT_GREY=Color.rgb(159,159,159)
11
+ LIGHTER_GREY=Color.rgb(191,191,191)
12
+ LIGHTEST_GREY=Color.rgb(223,223,223)
13
+ DARKEST_GRAY=Color.rgb(31,31,31)
14
+ DARKER_GRAY=Color.rgb(63,63,63)
15
+ DARK_GRAY=Color.rgb(95,95,95)
16
+ GRAY=Color.rgb(127,127,127)
17
+ LIGHT_GRAY=Color.rgb(159,159,159)
18
+ LIGHTER_GRAY=Color.rgb(191,191,191)
19
+ LIGHTEST_GRAY=Color.rgb(223,223,223)
20
+ WHITE=Color.rgb(255,255,255)
21
+
22
+ # sepia
23
+ DARKEST_SEPIA=Color.rgb(31,24,15)
24
+ DARKER_SEPIA=Color.rgb(63,50,31)
25
+ DARK_SEPIA=Color.rgb(94,75,47)
26
+ SEPIA=Color.rgb(127,101,63)
27
+ LIGHT_SEPIA=Color.rgb(158,134,100)
28
+ LIGHTER_SEPIA=Color.rgb(191,171,143)
29
+ LIGHTEST_SEPIA=Color.rgb(222,211,195)
30
+
31
+ #standard colors
32
+ RED=Color.rgb(255,0,0)
33
+ FLAME=Color.rgb(255,63,0)
34
+ ORANGE=Color.rgb(255,127,0)
35
+ AMBER=Color.rgb(255,191,0)
36
+ YELLOW=Color.rgb(255,255,0)
37
+ LIME=Color.rgb(191,255,0)
38
+ CHARTREUSE=Color.rgb(127,255,0)
39
+ GREEN=Color.rgb(0,255,0)
40
+ SEA=Color.rgb(0,255,127)
41
+ TURQUOISE=Color.rgb(0,255,191)
42
+ CYAN=Color.rgb(0,255,255)
43
+ SKY=Color.rgb(0,191,255)
44
+ AZURE=Color.rgb(0,127,255)
45
+ BLUE=Color.rgb(0,0,255)
46
+ HAN=Color.rgb(63,0,255)
47
+ VIOLET=Color.rgb(127,0,255)
48
+ PURPLE=Color.rgb(191,0,255)
49
+ FUCHSIA=Color.rgb(255,0,255)
50
+ MAGENTA=Color.rgb(255,0,191)
51
+ PINK=Color.rgb(255,0,127)
52
+ CRIMSON=Color.rgb(255,0,63)
53
+
54
+ # dark colors
55
+ DARK_RED=Color.rgb(191,0,0)
56
+ DARK_FLAME=Color.rgb(191,47,0)
57
+ DARK_ORANGE=Color.rgb(191,95,0)
58
+ DARK_AMBER=Color.rgb(191,143,0)
59
+ DARK_YELLOW=Color.rgb(191,191,0)
60
+ DARK_LIME=Color.rgb(143,191,0)
61
+ DARK_CHARTREUSE=Color.rgb(95,191,0)
62
+ DARK_GREEN=Color.rgb(0,191,0)
63
+ DARK_SEA=Color.rgb(0,191,95)
64
+ DARK_TURQUOISE=Color.rgb(0,191,143)
65
+ DARK_CYAN=Color.rgb(0,191,191)
66
+ DARK_SKY=Color.rgb(0,143,191)
67
+ DARK_AZURE=Color.rgb(0,95,191)
68
+ DARK_BLUE=Color.rgb(0,0,191)
69
+ DARK_HAN=Color.rgb(47,0,191)
70
+ DARK_VIOLET=Color.rgb(95,0,191)
71
+ DARK_PURPLE=Color.rgb(143,0,191)
72
+ DARK_FUCHSIA=Color.rgb(191,0,191)
73
+ DARK_MAGENTA=Color.rgb(191,0,143)
74
+ DARK_PINK=Color.rgb(191,0,95)
75
+ DARK_CRIMSON=Color.rgb(191,0,47)
76
+
77
+ # darker colors
78
+ DARKER_RED=Color.rgb(127,0,0)
79
+ DARKER_FLAME=Color.rgb(127,31,0)
80
+ DARKER_ORANGE=Color.rgb(127,63,0)
81
+ DARKER_AMBER=Color.rgb(127,95,0)
82
+ DARKER_YELLOW=Color.rgb(127,127,0)
83
+ DARKER_LIME=Color.rgb(95,127,0)
84
+ DARKER_CHARTREUSE=Color.rgb(63,127,0)
85
+ DARKER_GREEN=Color.rgb(0,127,0)
86
+ DARKER_SEA=Color.rgb(0,127,63)
87
+ DARKER_TURQUOISE=Color.rgb(0,127,95)
88
+ DARKER_CYAN=Color.rgb(0,127,127)
89
+ DARKER_SKY=Color.rgb(0,95,127)
90
+ DARKER_AZURE=Color.rgb(0,63,127)
91
+ DARKER_BLUE=Color.rgb(0,0,127)
92
+ DARKER_HAN=Color.rgb(31,0,127)
93
+ DARKER_VIOLET=Color.rgb(63,0,127)
94
+ DARKER_PURPLE=Color.rgb(95,0,127)
95
+ DARKER_FUCHSIA=Color.rgb(127,0,127)
96
+ DARKER_MAGENTA=Color.rgb(127,0,95)
97
+ DARKER_PINK=Color.rgb(127,0,63)
98
+ DARKER_CRIMSON=Color.rgb(127,0,31)
99
+
100
+ # darkest colors
101
+ DARKEST_RED=Color.rgb(63,0,0)
102
+ DARKEST_FLAME=Color.rgb(63,15,0)
103
+ DARKEST_ORANGE=Color.rgb(63,31,0)
104
+ DARKEST_AMBER=Color.rgb(63,47,0)
105
+ DARKEST_YELLOW=Color.rgb(63,63,0)
106
+ DARKEST_LIME=Color.rgb(47,63,0)
107
+ DARKEST_CHARTREUSE=Color.rgb(31,63,0)
108
+ DARKEST_GREEN=Color.rgb(0,63,0)
109
+ DARKEST_SEA=Color.rgb(0,63,31)
110
+ DARKEST_TURQUOISE=Color.rgb(0,63,47)
111
+ DARKEST_CYAN=Color.rgb(0,63,63)
112
+ DARKEST_SKY=Color.rgb(0,47,63)
113
+ DARKEST_AZURE=Color.rgb(0,31,63)
114
+ DARKEST_BLUE=Color.rgb(0,0,63)
115
+ DARKEST_HAN=Color.rgb(15,0,63)
116
+ DARKEST_VIOLET=Color.rgb(31,0,63)
117
+ DARKEST_PURPLE=Color.rgb(47,0,63)
118
+ DARKEST_FUCHSIA=Color.rgb(63,0,63)
119
+ DARKEST_MAGENTA=Color.rgb(63,0,47)
120
+ DARKEST_PINK=Color.rgb(63,0,31)
121
+ DARKEST_CRIMSON=Color.rgb(63,0,15)
122
+
123
+ # light colors
124
+ LIGHT_RED=Color.rgb(255,114,114)
125
+ LIGHT_FLAME=Color.rgb(255,149,114)
126
+ LIGHT_ORANGE=Color.rgb(255,184,114)
127
+ LIGHT_AMBER=Color.rgb(255,219,114)
128
+ LIGHT_YELLOW=Color.rgb(255,255,114)
129
+ LIGHT_LIME=Color.rgb(219,255,114)
130
+ LIGHT_CHARTREUSE=Color.rgb(184,255,114)
131
+ LIGHT_GREEN=Color.rgb(114,255,114)
132
+ LIGHT_SEA=Color.rgb(114,255,184)
133
+ LIGHT_TURQUOISE=Color.rgb(114,255,219)
134
+ LIGHT_CYAN=Color.rgb(114,255,255)
135
+ LIGHT_SKY=Color.rgb(114,219,255)
136
+ LIGHT_AZURE=Color.rgb(114,184,255)
137
+ LIGHT_BLUE=Color.rgb(114,114,255)
138
+ LIGHT_HAN=Color.rgb(149,114,255)
139
+ LIGHT_VIOLET=Color.rgb(184,114,255)
140
+ LIGHT_PURPLE=Color.rgb(219,114,255)
141
+ LIGHT_FUCHSIA=Color.rgb(255,114,255)
142
+ LIGHT_MAGENTA=Color.rgb(255,114,219)
143
+ LIGHT_PINK=Color.rgb(255,114,184)
144
+ LIGHT_CRIMSON=Color.rgb(255,114,149)
145
+
146
+ #lighter colors
147
+ LIGHTER_RED=Color.rgb(255,165,165)
148
+ LIGHTER_FLAME=Color.rgb(255,188,165)
149
+ LIGHTER_ORANGE=Color.rgb(255,210,165)
150
+ LIGHTER_AMBER=Color.rgb(255,232,165)
151
+ LIGHTER_YELLOW=Color.rgb(255,255,165)
152
+ LIGHTER_LIME=Color.rgb(232,255,165)
153
+ LIGHTER_CHARTREUSE=Color.rgb(210,255,165)
154
+ LIGHTER_GREEN=Color.rgb(165,255,165)
155
+ LIGHTER_SEA=Color.rgb(165,255,210)
156
+ LIGHTER_TURQUOISE=Color.rgb(165,255,232)
157
+ LIGHTER_CYAN=Color.rgb(165,255,255)
158
+ LIGHTER_SKY=Color.rgb(165,232,255)
159
+ LIGHTER_AZURE=Color.rgb(165,210,255)
160
+ LIGHTER_BLUE=Color.rgb(165,165,255)
161
+ LIGHTER_HAN=Color.rgb(188,165,255)
162
+ LIGHTER_VIOLET=Color.rgb(210,165,255)
163
+ LIGHTER_PURPLE=Color.rgb(232,165,255)
164
+ LIGHTER_FUCHSIA=Color.rgb(255,165,255)
165
+ LIGHTER_MAGENTA=Color.rgb(255,165,232)
166
+ LIGHTER_PINK=Color.rgb(255,165,210)
167
+ LIGHTER_CRIMSON=Color.rgb(255,165,188)
168
+
169
+ # lightest colors
170
+ LIGHTEST_RED=Color.rgb(255,191,191)
171
+ LIGHTEST_FLAME=Color.rgb(255,207,191)
172
+ LIGHTEST_ORANGE=Color.rgb(255,223,191)
173
+ LIGHTEST_AMBER=Color.rgb(255,239,191)
174
+ LIGHTEST_YELLOW=Color.rgb(255,255,191)
175
+ LIGHTEST_LIME=Color.rgb(239,255,191)
176
+ LIGHTEST_CHARTREUSE=Color.rgb(223,255,191)
177
+ LIGHTEST_GREEN=Color.rgb(191,255,191)
178
+ LIGHTEST_SEA=Color.rgb(191,255,223)
179
+ LIGHTEST_TURQUOISE=Color.rgb(191,255,239)
180
+ LIGHTEST_CYAN=Color.rgb(191,255,255)
181
+ LIGHTEST_SKY=Color.rgb(191,239,255)
182
+ LIGHTEST_AZURE=Color.rgb(191,223,255)
183
+ LIGHTEST_BLUE=Color.rgb(191,191,255)
184
+ LIGHTEST_HAN=Color.rgb(207,191,255)
185
+ LIGHTEST_VIOLET=Color.rgb(223,191,255)
186
+ LIGHTEST_PURPLE=Color.rgb(239,191,255)
187
+ LIGHTEST_FUCHSIA=Color.rgb(255,191,255)
188
+ LIGHTEST_MAGENTA=Color.rgb(255,191,239)
189
+ LIGHTEST_PINK=Color.rgb(255,191,223)
190
+ LIGHTEST_CRIMSON=Color.rgb(255,191,207)
191
+
192
+ # desaturated colors
193
+ DESATURATED_RED=Color.rgb(127,63,63)
194
+ DESATURATED_FLAME=Color.rgb(127,79,63)
195
+ DESATURATED_ORANGE=Color.rgb(127,95,63)
196
+ DESATURATED_AMBER=Color.rgb(127,111,63)
197
+ DESATURATED_YELLOW=Color.rgb(127,127,63)
198
+ DESATURATED_LIME=Color.rgb(111,127,63)
199
+ DESATURATED_CHARTREUSE=Color.rgb(95,127,63)
200
+ DESATURATED_GREEN=Color.rgb(63,127,63)
201
+ DESATURATED_SEA=Color.rgb(63,127,95)
202
+ DESATURATED_TURQUOISE=Color.rgb(63,127,111)
203
+ DESATURATED_CYAN=Color.rgb(63,127,127)
204
+ DESATURATED_SKY=Color.rgb(63,111,127)
205
+ DESATURATED_AZURE=Color.rgb(63,95,127)
206
+ DESATURATED_BLUE=Color.rgb(63,63,127)
207
+ DESATURATED_HAN=Color.rgb(79,63,127)
208
+ DESATURATED_VIOLET=Color.rgb(95,63,127)
209
+ DESATURATED_PURPLE=Color.rgb(111,63,127)
210
+ DESATURATED_FUCHSIA=Color.rgb(127,63,127)
211
+ DESATURATED_MAGENTA=Color.rgb(127,63,111)
212
+ DESATURATED_PINK=Color.rgb(127,63,95)
213
+ DESATURATED_CRIMSON=Color.rgb(127,63,79)
214
+
215
+ # metallic
216
+ BRASS=Color.rgb(191,151,96)
217
+ COPPER=Color.rgb(197,136,124)
218
+ GOLD=Color.rgb(229,191,0)
219
+ SILVER=Color.rgb(203,203,203)
220
+
221
+ # miscellaneous
222
+ CELADON=Color.rgb(172,255,175)
223
+ PEACH=Color.rgb(255,159,127)
224
+ end
225
+ end
@@ -0,0 +1,46 @@
1
+ module TCOD
2
+ class Console
3
+ attr_accessor :width, :height
4
+
5
+ def self.root
6
+ @root ||= TCOD.nsole.new(0, 0, true)
7
+ end
8
+
9
+ def initialize(w, h, root=False)
10
+ if root
11
+ @ptr = nil
12
+ else
13
+ @width = w
14
+ @height = w
15
+ @ptr = TCOD.console_new(w, h)
16
+ end
17
+ end
18
+
19
+ def self.init_root(width, height, title, fullscreen=false, renderer=RENDERER_SDL)
20
+ TCOD.console_init_root(width, height, title, fullscreen, renderer)
21
+ root.width = width
22
+ root.height = height
23
+ root
24
+ end
25
+
26
+ def window_closed?
27
+ TCOD.console_is_window_closed
28
+ end
29
+
30
+ def set_default_foreground(color)
31
+ TCOD.console_set_default_foreground(@ptr, color)
32
+ end
33
+
34
+ def put_char(x, y, c, flag=BKGND_DEFAULT)
35
+ TCOD.console_put_char(@ptr, x, y, c.ord, flag)
36
+ end
37
+
38
+ def flush
39
+ TCOD.console_flush
40
+ end
41
+
42
+ def wait_for_keypress(flush=false)
43
+ TCOD.console_wait_for_keypress(flush)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,218 @@
1
+ module TCOD
2
+ # background rendering modes
3
+ BKGND_NONE = 0
4
+ BKGND_SET = 1
5
+ BKGND_MULTIPLY = 2
6
+ BKGND_LIGHTEN = 3
7
+ BKGND_DARKEN = 4
8
+ BKGND_SCREEN = 5
9
+ BKGND_COLOR_DODGE = 6
10
+ BKGND_COLOR_BURN = 7
11
+ BKGND_ADD = 8
12
+ BKGND_ADDA = 9
13
+ BKGND_BURN = 10
14
+ BKGND_OVERLAY = 11
15
+ BKGND_ALPH = 12
16
+ BKGND_DEFAULT=13
17
+
18
+ # non blocking key events types
19
+ KEY_PRESSED = 1
20
+ KEY_RELEASED = 2
21
+
22
+ # key codes
23
+ KEY_NONE = 0
24
+ KEY_ESCAPE = 1
25
+ KEY_BACKSPACE = 2
26
+ KEY_TAB = 3
27
+ KEY_ENTER = 4
28
+ KEY_SHIFT = 5
29
+ KEY_CONTROL = 6
30
+ KEY_ALT = 7
31
+ KEY_PAUSE = 8
32
+ KEY_CAPSLOCK = 9
33
+ KEY_PAGEUP = 10
34
+ KEY_PAGEDOWN = 11
35
+ KEY_END = 12
36
+ KEY_HOME = 13
37
+ KEY_UP = 14
38
+ KEY_LEFT = 15
39
+ KEY_RIGHT = 16
40
+ KEY_DOWN = 17
41
+ KEY_PRINTSCREEN = 18
42
+ KEY_INSERT = 19
43
+ KEY_DELETE = 20
44
+ KEY_LWIN = 21
45
+ KEY_RWIN = 22
46
+ KEY_APPS = 23
47
+ KEY_0 = 24
48
+ KEY_1 = 25
49
+ KEY_2 = 26
50
+ KEY_3 = 27
51
+ KEY_4 = 28
52
+ KEY_5 = 29
53
+ KEY_6 = 30
54
+ KEY_7 = 31
55
+ KEY_8 = 32
56
+ KEY_9 = 33
57
+ KEY_KP0 = 34
58
+ KEY_KP1 = 35
59
+ KEY_KP2 = 36
60
+ KEY_KP3 = 37
61
+ KEY_KP4 = 38
62
+ KEY_KP5 = 39
63
+ KEY_KP6 = 40
64
+ KEY_KP7 = 41
65
+ KEY_KP8 = 42
66
+ KEY_KP9 = 43
67
+ KEY_KPADD = 44
68
+ KEY_KPSUB = 45
69
+ KEY_KPDIV = 46
70
+ KEY_KPMUL = 47
71
+ KEY_KPDEC = 48
72
+ KEY_KPENTER = 49
73
+ KEY_F1 = 50
74
+ KEY_F2 = 51
75
+ KEY_F3 = 52
76
+ KEY_F4 = 53
77
+ KEY_F5 = 54
78
+ KEY_F6 = 55
79
+ KEY_F7 = 56
80
+ KEY_F8 = 57
81
+ KEY_F9 = 58
82
+ KEY_F10 = 59
83
+ KEY_F11 = 60
84
+ KEY_F12 = 61
85
+ KEY_NUMLOCK = 62
86
+ KEY_SCROLLLOCK = 63
87
+ KEY_SPACE = 64
88
+ KEY_CHAR = 65
89
+
90
+ ### special chars
91
+
92
+ # single walls
93
+ CHAR_HLINE = 196
94
+ CHAR_VLINE = 179
95
+ CHAR_NE = 191
96
+ CHAR_NW = 218
97
+ CHAR_SE = 217
98
+ CHAR_SW = 192
99
+ CHAR_TEEW = 180
100
+ CHAR_TEEE = 195
101
+ CHAR_TEEN = 193
102
+ CHAR_TEES = 194
103
+ CHAR_CROSS = 197
104
+
105
+ # double walls
106
+ CHAR_DHLINE = 205
107
+ CHAR_DVLINE = 186
108
+ CHAR_DNE = 187
109
+ CHAR_DNW = 201
110
+ CHAR_DSE = 188
111
+ CHAR_DSW = 200
112
+ CHAR_DTEEW = 185
113
+ CHAR_DTEEE = 204
114
+ CHAR_DTEEN = 202
115
+ CHAR_DTEES = 203
116
+ CHAR_DCROSS = 206
117
+
118
+ # blocks
119
+ CHAR_BLOCK1 = 176
120
+ CHAR_BLOCK2 = 177
121
+ CHAR_BLOCK3 = 178
122
+
123
+ # arrows
124
+ CHAR_ARROW_N = 24
125
+ CHAR_ARROW_S = 25
126
+ CHAR_ARROW_E = 26
127
+ CHAR_ARROW_W = 27
128
+
129
+ # arrows without tail
130
+ CHAR_ARROW2_N = 30
131
+ CHAR_ARROW2_S = 31
132
+ CHAR_ARROW2_E = 16
133
+ CHAR_ARROW2_W = 17
134
+
135
+ # double arrows
136
+ CHAR_DARROW_H = 29
137
+ CHAR_DARROW_V = 18
138
+
139
+ # GUI stuff
140
+ CHAR_CHECKBOX_UNSET = 224
141
+ CHAR_CHECKBOX_SET = 225
142
+ CHAR_RADIO_UNSET = 9
143
+ CHAR_RADIO_SET = 10
144
+
145
+ # sub-pixel resolution kit
146
+ CHAR_SUBP_NW = 226
147
+ CHAR_SUBP_NE = 227
148
+ CHAR_SUBP_N = 228
149
+ CHAR_SUBP_SE = 229
150
+ CHAR_SUBP_DIAG = 230
151
+ CHAR_SUBP_E = 231
152
+ CHAR_SUBP_SW = 232
153
+
154
+ # misc characters
155
+ CHAR_BULLET = 7
156
+ CHAR_BULLET_INV = 8
157
+ CHAR_BULLET_SQUARE = 254
158
+ CHAR_CENT = 189
159
+ CHAR_CLUB = 5
160
+ CHAR_COPYRIGHT = 184
161
+ CHAR_CURRENCY = 207
162
+ CHAR_DIAMOND = 4
163
+ CHAR_DIVISION = 246
164
+ CHAR_EXCLAM_DOUBLE = 19
165
+ CHAR_FEMALE = 12
166
+ CHAR_FUNCTION = 159
167
+ CHAR_GRADE = 248
168
+ CHAR_HALF = 171
169
+ CHAR_HEART = 3
170
+ CHAR_LIGHT = 15
171
+ CHAR_MALE = 11
172
+ CHAR_MULTIPLICATION = 158
173
+ CHAR_NOTE = 13
174
+ CHAR_NOTE_DOUBLE = 14
175
+ CHAR_ONE_QUARTER = 172
176
+ CHAR_PILCROW = 20
177
+ CHAR_POUND = 156
178
+ CHAR_POW1 = 251
179
+ CHAR_POW2 = 253
180
+ CHAR_POW3 = 252
181
+ CHAR_RESERVED = 169
182
+ CHAR_SECTION = 21
183
+ CHAR_SMILIE = 1
184
+ CHAR_SMILIE_INV = 2
185
+ CHAR_SPADE = 6
186
+ CHAR_THREE_QUARTERS = 243
187
+ CHAR_UMLAUT = 249
188
+ CHAR_YEN = 190
189
+
190
+ # font flags
191
+ FONT_LAYOUT_ASCII_INCOL = 1
192
+ FONT_LAYOUT_ASCII_INROW = 2
193
+ FONT_TYPE_GREYSCALE = 4
194
+ FONT_TYPE_GRAYSCALE = 4
195
+ FONT_LAYOUT_TCOD = 8
196
+
197
+ # color control codes
198
+ COLCTRL_1=1
199
+ COLCTRL_2=2
200
+ COLCTRL_3=3
201
+ COLCTRL_4=4
202
+ COLCTRL_5=5
203
+ COLCTRL_NUMBER=5
204
+ COLCTRL_FORE_RGB=6
205
+ COLCTRL_BACK_RGB=7
206
+ COLCTRL_STOP=8
207
+
208
+ # renderers
209
+ RENDERER_GLSL=0
210
+ RENDERER_OPENGL=1
211
+ RENDERER_SDL=2
212
+ NB_RENDERERS=3
213
+
214
+ # alignment
215
+ LEFT=0
216
+ RIGHT=1
217
+ CENTER=2
218
+ end