Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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