You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 18 години
преди 19 години
преди 19 години
преди 19 години
преди 19 години
преди 19 години
преди 19 години
преди 19 години
преди 18 години
преди 19 години
преди 19 години
преди 19 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*
  2. * libcaca Colour ASCII-Art library
  3. * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This library is free software. It comes without any warranty, to
  9. * the extent permitted by applicable law. You can redistribute it
  10. * and/or modify it under the terms of the Do What The Fuck You Want
  11. * To Public License, Version 2, as published by Sam Hocevar. See
  12. * http://sam.zoy.org/wtfpl/COPYING for more details.
  13. */
  14. #ifndef __CACA_INTERNALS_H__
  15. #define __CACA_INTERNALS_H__
  16. #if defined(HAVE_INTTYPES_H) && !defined(__KERNEL__)
  17. # include <inttypes.h>
  18. #endif
  19. typedef struct caca_timer caca_timer_t;
  20. #if !defined(_DOXYGEN_SKIP_ME)
  21. # define EVENTBUF_LEN 10
  22. #endif
  23. /* Graphics driver */
  24. enum caca_driver
  25. {
  26. CACA_DRIVER_NONE = 0,
  27. CACA_DRIVER_RAW = 1,
  28. #if defined(USE_COCOA)
  29. CACA_DRIVER_COCOA = 2,
  30. #endif
  31. #if defined(USE_CONIO)
  32. CACA_DRIVER_CONIO = 3,
  33. #endif
  34. #if defined(USE_GL)
  35. CACA_DRIVER_GL = 4,
  36. #endif
  37. #if defined(USE_NCURSES)
  38. CACA_DRIVER_NCURSES = 5,
  39. #endif
  40. #if defined(USE_SLANG)
  41. CACA_DRIVER_SLANG = 6,
  42. #endif
  43. #if defined(USE_VGA)
  44. CACA_DRIVER_VGA = 7,
  45. #endif
  46. #if defined(USE_WIN32)
  47. CACA_DRIVER_WIN32 = 8,
  48. #endif
  49. #if defined(USE_X11)
  50. CACA_DRIVER_X11 = 9,
  51. #endif
  52. };
  53. /* Available external drivers */
  54. #if defined(USE_COCOA)
  55. int cocoa_install(caca_display_t *);
  56. #endif
  57. #if defined(USE_CONIO)
  58. int conio_install(caca_display_t *);
  59. #endif
  60. #if defined(USE_GL)
  61. int gl_install(caca_display_t *);
  62. #endif
  63. #if defined(USE_NCURSES)
  64. int ncurses_install(caca_display_t *);
  65. #endif
  66. int raw_install(caca_display_t *);
  67. #if defined(USE_SLANG)
  68. int slang_install(caca_display_t *);
  69. #endif
  70. #if defined(USE_VGA)
  71. int vga_install(caca_display_t *);
  72. #endif
  73. #if defined(USE_WIN32)
  74. int win32_install(caca_display_t *);
  75. #endif
  76. #if defined(USE_X11)
  77. int x11_install(caca_display_t *);
  78. #endif
  79. /* Timer structure */
  80. struct caca_timer
  81. {
  82. int last_sec, last_usec;
  83. };
  84. /* Internal caca display context */
  85. struct caca_display
  86. {
  87. /* A link to our cucul canvas */
  88. cucul_canvas_t *cv;
  89. #if defined(USE_PLUGINS)
  90. void *plugin;
  91. #endif
  92. /* Device-specific functions */
  93. struct drv
  94. {
  95. enum caca_driver driver;
  96. struct driver_private *p;
  97. int (* init_graphics) (caca_display_t *);
  98. int (* end_graphics) (caca_display_t *);
  99. int (* set_display_title) (caca_display_t *, char const *);
  100. unsigned int (* get_display_width) (caca_display_t *);
  101. unsigned int (* get_display_height) (caca_display_t *);
  102. void (* display) (caca_display_t *);
  103. void (* handle_resize) (caca_display_t *);
  104. int (* get_event) (caca_display_t *, caca_event_t *);
  105. void (* set_mouse) (caca_display_t *, int);
  106. void (* set_cursor) (caca_display_t *, int);
  107. } drv;
  108. /* Mouse position */
  109. struct mouse
  110. {
  111. unsigned int x, y;
  112. } mouse;
  113. /* Window resize handling */
  114. struct resize
  115. {
  116. int resized; /* A resize event was requested */
  117. unsigned w, h; /* Requested width and height */
  118. } resize;
  119. /* Framerate handling */
  120. unsigned int delay, rendertime;
  121. caca_timer_t timer;
  122. int lastticks;
  123. struct events
  124. {
  125. #if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
  126. caca_event_t buf[EVENTBUF_LEN];
  127. int queue;
  128. #endif
  129. #if defined(USE_SLANG) || defined(USE_NCURSES)
  130. caca_timer_t key_timer;
  131. unsigned int last_key_ticks;
  132. unsigned int autorepeat_ticks;
  133. caca_event_t last_key_event;
  134. #endif
  135. #if defined(USE_WIN32)
  136. unsigned char not_empty_struct;
  137. #endif
  138. } events;
  139. };
  140. /* Internal timer functions */
  141. extern void _caca_sleep(unsigned int);
  142. extern unsigned int _caca_getticks(caca_timer_t *);
  143. /* Internal event functions */
  144. extern void _caca_handle_resize(caca_display_t *);
  145. #if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
  146. extern void _push_event(caca_display_t *, caca_event_t *);
  147. extern int _pop_event(caca_display_t *, caca_event_t *);
  148. #endif
  149. /* Internal window functions */
  150. extern void _caca_set_term_title(char const *);
  151. #endif /* __CACA_INTERNALS_H__ */