25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

188 satır
4.4 KiB

  1. /*
  2. * libcaca ASCII-Art library
  3. * Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this library; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  21. * 02111-1307 USA
  22. */
  23. #ifndef __CACA_H__
  24. #define __CACA_H__
  25. #ifdef __cplusplus
  26. extern "C"
  27. {
  28. #endif
  29. /*
  30. * Colors
  31. */
  32. enum caca_color
  33. {
  34. CACA_COLOR_BLACK = 0,
  35. CACA_COLOR_BLUE = 1,
  36. CACA_COLOR_GREEN = 2,
  37. CACA_COLOR_CYAN = 3,
  38. CACA_COLOR_RED = 4,
  39. CACA_COLOR_MAGENTA = 5,
  40. CACA_COLOR_BROWN = 6,
  41. CACA_COLOR_LIGHTGRAY = 7,
  42. CACA_COLOR_DARKGRAY = 8,
  43. CACA_COLOR_LIGHTBLUE = 9,
  44. CACA_COLOR_LIGHTGREEN = 10,
  45. CACA_COLOR_LIGHTCYAN = 11,
  46. CACA_COLOR_LIGHTRED = 12,
  47. CACA_COLOR_LIGHTMAGENTA = 13,
  48. CACA_COLOR_YELLOW = 14,
  49. CACA_COLOR_WHITE = 15
  50. };
  51. /*
  52. * Dithering modes
  53. */
  54. enum caca_dithering
  55. {
  56. CACA_DITHER_NONE,
  57. CACA_DITHER_ORDERED,
  58. CACA_DITHER_RANDOM
  59. };
  60. /*
  61. * Events
  62. */
  63. enum caca_event
  64. {
  65. CACA_EVENT_NONE = 0x00000000,
  66. CACA_EVENT_KEY_PRESS = 0x01000000,
  67. CACA_EVENT_KEY_RELEASE = 0x02000000,
  68. CACA_EVENT_MOUSE_CLICK = 0x04000000
  69. };
  70. /*
  71. * Keys
  72. */
  73. enum caca_key
  74. {
  75. CACA_KEY_UP = 273,
  76. CACA_KEY_DOWN = 274,
  77. CACA_KEY_LEFT = 275,
  78. CACA_KEY_RIGHT = 276,
  79. CACA_KEY_F1 = 282,
  80. CACA_KEY_F2 = 283,
  81. CACA_KEY_F3 = 284,
  82. CACA_KEY_F4 = 285,
  83. CACA_KEY_F5 = 286,
  84. CACA_KEY_F6 = 287,
  85. CACA_KEY_F7 = 288,
  86. CACA_KEY_F8 = 289,
  87. CACA_KEY_F9 = 290,
  88. CACA_KEY_F10 = 291,
  89. CACA_KEY_F11 = 292,
  90. CACA_KEY_F12 = 293,
  91. CACA_KEY_F13 = 294,
  92. CACA_KEY_F14 = 295,
  93. CACA_KEY_F15 = 296
  94. };
  95. /*
  96. * Internal types
  97. */
  98. struct caca_sprite;
  99. struct caca_bitmap;
  100. /*
  101. * Basic functions
  102. */
  103. int caca_init(void);
  104. void caca_set_delay(unsigned int);
  105. void caca_set_dithering(enum caca_dithering);
  106. unsigned int caca_get_rendertime(void);
  107. unsigned int caca_get_width(void);
  108. unsigned int caca_get_height(void);
  109. const char *caca_get_color_name(unsigned int);
  110. void caca_refresh(void);
  111. void caca_end(void);
  112. /*
  113. * Events
  114. */
  115. int caca_get_event(void);
  116. /*
  117. * Character graphics
  118. */
  119. void caca_set_color(enum caca_color);
  120. enum caca_color caca_get_color(void);
  121. void caca_putchar(int, int, char);
  122. void caca_putstr(int, int, const char *);
  123. void caca_printf(int, int, const char *, ...);
  124. void caca_clear(void);
  125. /*
  126. * Graphics primitives
  127. */
  128. void caca_draw_line(int, int, int, int, char);
  129. void caca_draw_polyline(const int[], const int[], int, char);
  130. void caca_draw_thin_line(int, int, int, int);
  131. void caca_draw_thin_polyline(const int[], const int[], int);
  132. void caca_draw_circle(int, int, int, char);
  133. void caca_draw_ellipse(int, int, int, int, char);
  134. void caca_draw_thin_ellipse(int, int, int, int);
  135. void caca_fill_ellipse(int, int, int, int, char);
  136. void caca_draw_box(int, int, int, int, char);
  137. void caca_draw_thin_box(int, int, int, int);
  138. void caca_fill_box(int, int, int, int, char);
  139. void caca_draw_triangle(int, int, int, int, int, int, char);
  140. void caca_draw_thin_triangle(int, int, int, int, int, int);
  141. void caca_fill_triangle(int, int, int, int, int, int, char);
  142. /*
  143. * Maths
  144. */
  145. int caca_rand(int, int);
  146. unsigned int caca_sqrt(unsigned int);
  147. /*
  148. * Sprite handling
  149. */
  150. struct caca_sprite * caca_load_sprite(const char *);
  151. int caca_get_sprite_frames(struct caca_sprite *);
  152. int caca_get_sprite_width(struct caca_sprite *, int);
  153. int caca_get_sprite_height(struct caca_sprite *, int);
  154. int caca_get_sprite_dx(struct caca_sprite *, int);
  155. int caca_get_sprite_dy(struct caca_sprite *, int);
  156. void caca_draw_sprite(int, int, struct caca_sprite *, int);
  157. void caca_free_sprite(struct caca_sprite *);
  158. /*
  159. * Bitmap handling
  160. */
  161. struct caca_bitmap *caca_create_bitmap(int, int, int, int, int, int, int);
  162. void caca_draw_bitmap(int, int, int, int, struct caca_bitmap *, char *);
  163. void caca_free_bitmap(struct caca_bitmap *);
  164. #ifdef __cplusplus
  165. }
  166. #endif
  167. #endif /* __CACA_H__ */