No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

160 líneas
5.0 KiB

  1. /*
  2. * PypyCaca libcaca Python bindings
  3. * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
  4. * All Rights Reserved
  5. *
  6. * This library is free software. It comes without any warranty, to
  7. * the extent permitted by applicable law. You can redistribute it
  8. * and/or modify it under the terms of the Do What The Fuck You Want
  9. * To Public License, Version 2, as published by Sam Hocevar. See
  10. * http://sam.zoy.org/wtfpl/COPYING for more details.
  11. */
  12. #include <Python.h>
  13. #include <caca.h>
  14. #define SET_INTCONSTANT(dict, value) \
  15. PyDict_SetItemString(dict, #value, PyInt_FromLong((long) value))
  16. PyMODINIT_FUNC initcaca(void);
  17. /* Basic functions */
  18. static PyObject *
  19. pycaca_init(PyObject *self, PyObject *args);
  20. static PyObject *
  21. pycaca_set_display_time(PyObject *self, PyObject *args);
  22. static PyObject *
  23. pycaca_get_display_time(PyObject *self, PyObject *args);
  24. static PyObject *
  25. pycaca_get_width(PyObject *self, PyObject *args);
  26. static PyObject *
  27. pycaca_get_height(PyObject *self, PyObject *args);
  28. static PyObject *
  29. pycaca_set_size(PyObject *self, PyObject *args);
  30. static PyObject *
  31. pycaca_set_width(PyObject *self, PyObject *args);
  32. static PyObject *
  33. pycaca_set_height(PyObject *self, PyObject *args);
  34. static PyObject *
  35. pycaca_set_display_title(PyObject *self, PyObject *args);
  36. static PyObject *
  37. pycaca_get_display_width(PyObject *self, PyObject *args);
  38. static PyObject *
  39. pycaca_get_display_height(PyObject *self, PyObject *args);
  40. static PyObject *
  41. pycaca_refresh(PyObject *self, PyObject *args);
  42. static PyObject *
  43. pycaca_end(PyObject *self, PyObject *args);
  44. static PyObject *
  45. pycaca_get_feature(PyObject *self, PyObject *args);
  46. static PyObject *
  47. pycaca_set_feature(PyObject *self, PyObject *args);
  48. static PyObject *
  49. pycaca_get_feature_name(PyObject *self, PyObject *args);
  50. /* Event handling */
  51. static PyObject *
  52. pycaca_get_event(PyObject *self, PyObject *args);
  53. static PyObject *
  54. pycaca_wait_event(PyObject *self, PyObject *args);
  55. static PyObject *
  56. pycaca_get_mouse_x(PyObject *self, PyObject *args);
  57. static PyObject *
  58. pycaca_get_mouse_y(PyObject *self, PyObject *args);
  59. /* Primitives drawing */
  60. static PyObject *
  61. pycaca_draw_line(PyObject *self, PyObject *args);
  62. static PyObject *
  63. pycaca_draw_polyline(PyObject *self, PyObject *args);
  64. static PyObject *
  65. pycaca_draw_thin_polyline(PyObject *self, PyObject *args);
  66. static PyObject *
  67. pycaca_draw_thin_line(PyObject *self, PyObject *args);
  68. static PyObject *
  69. pycaca_draw_circle(PyObject *self, PyObject *args);
  70. static PyObject *
  71. pycaca_draw_ellipse(PyObject *self, PyObject *args);
  72. static PyObject *
  73. pycaca_draw_thin_ellipse(PyObject *self, PyObject *args);
  74. static PyObject *
  75. pycaca_fill_ellipse(PyObject *self, PyObject *args);
  76. static PyObject *
  77. pycaca_draw_box(PyObject *self, PyObject *args);
  78. static PyObject *
  79. pycaca_fill_box(PyObject *self, PyObject *args);
  80. static PyObject *
  81. pycaca_draw_thin_box(PyObject *self, PyObject *args);
  82. static PyObject *
  83. pycaca_draw_triangle(PyObject *self, PyObject *args);
  84. static PyObject *
  85. pycaca_draw_thin_triangle(PyObject *self, PyObject *args);
  86. static PyObject *
  87. pycaca_fill_triangle(PyObject *self, PyObject *args);
  88. /* Charactere drawing */
  89. static PyObject *
  90. pycaca_set_color(PyObject *self, PyObject *args);
  91. static PyObject *
  92. pycaca_get_fg_color(PyObject *self, PyObject *args);
  93. static PyObject *
  94. pycaca_get_bg_color(PyObject *self, PyObject *args);
  95. static PyObject *
  96. pycaca_get_color_name(PyObject *self, PyObject *args);
  97. static PyObject *
  98. pycaca_putchar(PyObject *self, PyObject *args);
  99. static PyObject *
  100. pycaca_putstr(PyObject *self, PyObject *args);
  101. static PyObject *
  102. pycaca_printf(PyObject *self, PyObject *args);
  103. /*static PyObject *
  104. pycaca_get_screen(PyObject *self, PyObject *args);*/
  105. static PyObject *
  106. pycaca_clear(PyObject *self, PyObject *args);
  107. /* Sprites functions */
  108. static PyObject *
  109. pycaca_load_sprite(PyObject *self, PyObject *args);
  110. static PyObject *
  111. pycaca_draw_sprite(PyObject *self, PyObject *args);
  112. static PyObject *
  113. pycaca_get_sprite_frames(PyObject *self, PyObject *args);
  114. static PyObject *
  115. pycaca_get_sprite_width(PyObject *self, PyObject *args);
  116. static PyObject *
  117. pycaca_get_sprite_height(PyObject *self, PyObject *args);
  118. static PyObject *
  119. pycaca_get_sprite_dx(PyObject *self, PyObject *args);
  120. static PyObject *
  121. pycaca_get_sprite_dy(PyObject *self, PyObject *args);
  122. static PyObject *
  123. pycaca_free_sprite(PyObject *self, PyObject *args);
  124. /* Exporters */
  125. static PyObject *
  126. pycaca_get_html(PyObject *self, PyObject *args);
  127. static PyObject *
  128. pycaca_get_html3(PyObject *self, PyObject *args);
  129. static PyObject *
  130. pycaca_get_irc(PyObject *self, PyObject *args);
  131. static PyObject *
  132. pycaca_get_ansi(PyObject *self, PyObject *args);
  133. /* Bitmap functions */
  134. static PyObject *
  135. pycaca_create_bitmap(PyObject *self, PyObject *args);
  136. static PyObject *
  137. pycaca_set_bitmap_palette(PyObject *self, PyObject *args);
  138. static PyObject *
  139. pycaca_set_bitmap_gamma(PyObject *self, PyObject *args);
  140. static PyObject *
  141. pycaca_draw_bitmap(PyObject *self, PyObject *args);
  142. static PyObject *
  143. pycaca_free_bitmap(PyObject *self, PyObject *args);