25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Constants.pm 7.0 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. package Term::Caca::Constants;
  2. use strict;
  3. use base 'Exporter';
  4. use vars qw(@EXPORT_OK %EXPORT_TAGS $VERSION);
  5. $VERSION = '0.9';
  6. use constant {
  7. ## enum caca_color
  8. CACA_COLOR_BLACK => 0,
  9. CACA_COLOR_BLUE => 1,
  10. CACA_COLOR_GREEN => 2,
  11. CACA_COLOR_CYAN => 3,
  12. CACA_COLOR_RED => 4,
  13. CACA_COLOR_MAGENTA => 5,
  14. CACA_COLOR_BROWN => 6,
  15. CACA_COLOR_LIGHTGRAY => 7,
  16. CACA_COLOR_DARKGRAY => 8,
  17. CACA_COLOR_LIGHTBLUE => 9,
  18. CACA_COLOR_LIGHTGREEN => 10,
  19. CACA_COLOR_LIGHTCYAN => 11,
  20. CACA_COLOR_LIGHTRED => 12,
  21. CACA_COLOR_LIGHTMAGENTA => 13,
  22. CACA_COLOR_YELLOW => 14,
  23. CACA_COLOR_WHITE => 15,
  24. ## enum caca_feature
  25. CACA_BACKGROUND => 0x10,
  26. CACA_BACKGROUND_BLACK => 0x11,
  27. CACA_BACKGROUND_SOLID => 0x12,
  28. CACA_BACKGROUND_MIN => 0x11,
  29. CACA_BACKGROUND_MAX => 0x12,
  30. CACA_ANTIALIASING => 0x20,
  31. CACA_ANTIALIASING_NONE => 0x21,
  32. CACA_ANTIALIASING_PREFILTER => 0x22,
  33. CACA_ANTIALIASING_MIN => 0x21,
  34. CACA_ANTIALIASING_MAX => 0x22,
  35. CACA_DITHERING => 0x30,
  36. CACA_DITHERING_NONE => 0x31,
  37. CACA_DITHERING_ORDERED2 => 0x32,
  38. CACA_DITHERING_ORDERED4 => 0x33,
  39. CACA_DITHERING_ORDERED8 => 0x34,
  40. CACA_DITHERING_RANDOM => 0x35,
  41. CACA_DITHERING_MIN => 0x31,
  42. CACA_DITHERING_MAX => 0x35,
  43. CACA_FEATURE_UNKNOWN => 0xffff,
  44. ## enum caca_event
  45. CACA_EVENT_NONE => 0x00000000,
  46. CACA_EVENT_KEY_PRESS => 0x01000000,
  47. CACA_EVENT_KEY_RELEASE => 0x02000000,
  48. CACA_EVENT_MOUSE_PRESS => 0x04000000,
  49. CACA_EVENT_MOUSE_RELEASE => 0x08000000,
  50. CACA_EVENT_MOUSE_MOTION => 0x10000000,
  51. CACA_EVENT_RESIZE => 0x20000000,
  52. CACA_EVENT_ANY => 0xff000000,
  53. ## enum caca_key
  54. CACA_KEY_UNKNOWN => 0,
  55. # /* The following keys have ASCII equivalents */
  56. CACA_KEY_BACKSPACE => 8,
  57. CACA_KEY_TAB => 9,
  58. CACA_KEY_RETURN => 13,
  59. CACA_KEY_PAUSE => 19,
  60. CACA_KEY_ESCAPE => 27,
  61. CACA_KEY_DELETE => 127,
  62. # /* The following keys do not have ASCII equivalents but have been
  63. # * chosen to match the SDL equivalents */
  64. CACA_KEY_UP => 273,
  65. CACA_KEY_DOWN => 274,
  66. CACA_KEY_LEFT => 275,
  67. CACA_KEY_RIGHT => 276,
  68. CACA_KEY_INSERT => 277,
  69. CACA_KEY_HOME => 278,
  70. CACA_KEY_END => 279,
  71. CACA_KEY_PAGEUP => 280,
  72. CACA_KEY_PAGEDOWN => 281,
  73. CACA_KEY_F1 => 282,
  74. CACA_KEY_F2 => 283,
  75. CACA_KEY_F3 => 284,
  76. CACA_KEY_F4 => 285,
  77. CACA_KEY_F5 => 286,
  78. CACA_KEY_F6 => 287,
  79. CACA_KEY_F7 => 288,
  80. CACA_KEY_F8 => 289,
  81. CACA_KEY_F9 => 290,
  82. CACA_KEY_F10 => 291,
  83. CACA_KEY_F11 => 292,
  84. CACA_KEY_F12 => 293,
  85. CACA_KEY_F13 => 294,
  86. CACA_KEY_F14 => 295,
  87. CACA_KEY_F15 => 296,
  88. };
  89. @EXPORT_OK = qw(
  90. CACA_COLOR_BLACK
  91. CACA_COLOR_BLUE
  92. CACA_COLOR_GREEN
  93. CACA_COLOR_CYAN
  94. CACA_COLOR_RED
  95. CACA_COLOR_MAGENTA
  96. CACA_COLOR_BROWN
  97. CACA_COLOR_LIGHTGRAY
  98. CACA_COLOR_DARKGRAY
  99. CACA_COLOR_LIGHTBLUE
  100. CACA_COLOR_LIGHTGREEN
  101. CACA_COLOR_LIGHTCYAN
  102. CACA_COLOR_LIGHTRED
  103. CACA_COLOR_LIGHTMAGENTA
  104. CACA_COLOR_YELLOW
  105. CACA_COLOR_WHITE
  106. CACA_BACKGROUND
  107. CACA_BACKGROUND_BLACK
  108. CACA_BACKGROUND_SOLID
  109. CACA_BACKGROUND_MIN
  110. CACA_BACKGROUND_MAX
  111. CACA_ANTIALIASING
  112. CACA_ANTIALIASING_NONE
  113. CACA_ANTIALIASING_PREFILTER
  114. CACA_ANTIALIASING_MIN
  115. CACA_ANTIALIASING_MAX
  116. CACA_DITHERING
  117. CACA_DITHERING_NONE
  118. CACA_DITHERING_ORDERED2
  119. CACA_DITHERING_ORDERED4
  120. CACA_DITHERING_ORDERED8
  121. CACA_DITHERING_RANDOM
  122. CACA_DITHERING_MIN
  123. CACA_DITHERING_MAX
  124. CACA_FEATURE_UNKNOWN
  125. CACA_EVENT_NONE
  126. CACA_EVENT_KEY_PRESS
  127. CACA_EVENT_KEY_RELEASE
  128. CACA_EVENT_MOUSE_PRESS
  129. CACA_EVENT_MOUSE_RELEASE
  130. CACA_EVENT_MOUSE_MOTION
  131. CACA_EVENT_RESIZE
  132. CACA_EVENT_ANY
  133. CACA_KEY_UNKNOWN
  134. CACA_KEY_BACKSPACE
  135. CACA_KEY_TAB
  136. CACA_KEY_RETURN
  137. CACA_KEY_PAUSE
  138. CACA_KEY_ESCAPE
  139. CACA_KEY_DELETE
  140. CACA_KEY_UP
  141. CACA_KEY_DOWN
  142. CACA_KEY_LEFT
  143. CACA_KEY_RIGHT
  144. CACA_KEY_INSERT
  145. CACA_KEY_HOME
  146. CACA_KEY_END
  147. CACA_KEY_PAGEUP
  148. CACA_KEY_PAGEDOWN
  149. CACA_KEY_F1
  150. CACA_KEY_F2
  151. CACA_KEY_F3
  152. CACA_KEY_F4
  153. CACA_KEY_F5
  154. CACA_KEY_F6
  155. CACA_KEY_F7
  156. CACA_KEY_F8
  157. CACA_KEY_F9
  158. CACA_KEY_F10
  159. CACA_KEY_F11
  160. CACA_KEY_F12
  161. CACA_KEY_F13
  162. CACA_KEY_F14
  163. CACA_KEY_F15
  164. );
  165. %EXPORT_TAGS = (
  166. colors => [ qw(
  167. CACA_COLOR_BLACK
  168. CACA_COLOR_BLUE
  169. CACA_COLOR_GREEN
  170. CACA_COLOR_CYAN
  171. CACA_COLOR_RED
  172. CACA_COLOR_MAGENTA
  173. CACA_COLOR_BROWN
  174. CACA_COLOR_LIGHTGRAY
  175. CACA_COLOR_DARKGRAY
  176. CACA_COLOR_LIGHTBLUE
  177. CACA_COLOR_LIGHTGREEN
  178. CACA_COLOR_LIGHTCYAN
  179. CACA_COLOR_LIGHTRED
  180. CACA_COLOR_LIGHTMAGENTA
  181. CACA_COLOR_YELLOW
  182. CACA_COLOR_WHITE
  183. ) ],
  184. features => [ qw(
  185. CACA_BACKGROUND
  186. CACA_BACKGROUND_BLACK
  187. CACA_BACKGROUND_SOLID
  188. CACA_BACKGROUND_MIN
  189. CACA_BACKGROUND_MAX
  190. CACA_ANTIALIASING
  191. CACA_ANTIALIASING_NONE
  192. CACA_ANTIALIASING_PREFILTER
  193. CACA_ANTIALIASING_MIN
  194. CACA_ANTIALIASING_MAX
  195. CACA_DITHERING
  196. CACA_DITHERING_NONE
  197. CACA_DITHERING_ORDERED2
  198. CACA_DITHERING_ORDERED4
  199. CACA_DITHERING_ORDERED8
  200. CACA_DITHERING_RANDOM
  201. CACA_DITHERING_MIN
  202. CACA_DITHERING_MAX
  203. CACA_FEATURE_UNKNOWN
  204. ) ],
  205. events => [ qw(
  206. CACA_EVENT_NONE
  207. CACA_EVENT_KEY_PRESS
  208. CACA_EVENT_KEY_RELEASE
  209. CACA_EVENT_MOUSE_PRESS
  210. CACA_EVENT_MOUSE_RELEASE
  211. CACA_EVENT_MOUSE_MOTION
  212. CACA_EVENT_RESIZE
  213. CACA_EVENT_ANY
  214. ) ],
  215. 'keys' => [ qw(
  216. CACA_KEY_UNKNOWN
  217. CACA_KEY_BACKSPACE
  218. CACA_KEY_TAB
  219. CACA_KEY_RETURN
  220. CACA_KEY_PAUSE
  221. CACA_KEY_ESCAPE
  222. CACA_KEY_DELETE
  223. CACA_KEY_UP
  224. CACA_KEY_DOWN
  225. CACA_KEY_LEFT
  226. CACA_KEY_RIGHT
  227. CACA_KEY_INSERT
  228. CACA_KEY_HOME
  229. CACA_KEY_END
  230. CACA_KEY_PAGEUP
  231. CACA_KEY_PAGEDOWN
  232. CACA_KEY_F1
  233. CACA_KEY_F2
  234. CACA_KEY_F3
  235. CACA_KEY_F4
  236. CACA_KEY_F5
  237. CACA_KEY_F6
  238. CACA_KEY_F7
  239. CACA_KEY_F8
  240. CACA_KEY_F9
  241. CACA_KEY_F10
  242. CACA_KEY_F11
  243. CACA_KEY_F12
  244. CACA_KEY_F13
  245. CACA_KEY_F14
  246. CACA_KEY_F15
  247. ) ],
  248. all => [ ],
  249. );
  250. # add all the other ":class" tags to the ":all" class,
  251. # deleting duplicates
  252. {
  253. my %seen;
  254. push @{$EXPORT_TAGS{all}},
  255. grep {!$seen{$_}++} @{$EXPORT_TAGS{$_}} foreach keys %EXPORT_TAGS;
  256. }
  257. 1;
  258. __END__
  259. =head1 NAME
  260. Term::Caca::Constants - libcaca constants from caca.h
  261. =head1 SYNOPSIS
  262. Import all constants into current package/namespace:
  263. use Term::Caca::Constants ':all';
  264. Only import the constants pertaining to events and keys:
  265. use Term::Caca qw(:events :keys);
  266. =head1 DESCRIPTION
  267. =cut
  268. # $Id$