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

99 строки
2.0 KiB

  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; you can redistribute it and/or
  9. * modify it under the terms of the Do What The Fuck You Want To
  10. * Public License, Version 2, as published by Sam Hocevar. See
  11. * http://sam.zoy.org/wtfpl/COPYING for more details.
  12. */
  13. /*
  14. * This file contains the libcaca raw input and output driver
  15. */
  16. #include "config.h"
  17. #include "common.h"
  18. #if !defined(__KERNEL__)
  19. #include <stdio.h>
  20. #include "caca.h"
  21. #include "caca_internals.h"
  22. #include "cucul.h"
  23. #include "cucul_internals.h"
  24. static int raw_init_graphics(caca_display_t *dp)
  25. {
  26. return 0;
  27. }
  28. static int raw_end_graphics(caca_display_t *dp)
  29. {
  30. return 0;
  31. }
  32. static int raw_set_display_title(caca_display_t *dp, char const *title)
  33. {
  34. return -1;
  35. }
  36. static unsigned int raw_get_display_width(caca_display_t *dp)
  37. {
  38. return 0;
  39. }
  40. static unsigned int raw_get_display_height(caca_display_t *dp)
  41. {
  42. return 0;
  43. }
  44. static void raw_display(caca_display_t *dp)
  45. {
  46. cucul_buffer_t *buffer;
  47. buffer = cucul_export_canvas(dp->cv, "caca");
  48. fwrite(cucul_get_buffer_data(buffer),
  49. cucul_get_buffer_size(buffer), 1, stdout);
  50. fflush(stdout);
  51. cucul_free_buffer(buffer);
  52. }
  53. static void raw_handle_resize(caca_display_t *dp)
  54. {
  55. ;
  56. }
  57. static int raw_get_event(caca_display_t *dp, caca_event_t *ev)
  58. {
  59. ev->type = CACA_EVENT_NONE;
  60. return 0;
  61. }
  62. /*
  63. * Driver initialisation
  64. */
  65. int raw_install(caca_display_t *dp)
  66. {
  67. dp->drv.driver = CACA_DRIVER_RAW;
  68. dp->drv.init_graphics = raw_init_graphics;
  69. dp->drv.end_graphics = raw_end_graphics;
  70. dp->drv.set_display_title = raw_set_display_title;
  71. dp->drv.get_display_width = raw_get_display_width;
  72. dp->drv.get_display_height = raw_get_display_height;
  73. dp->drv.display = raw_display;
  74. dp->drv.handle_resize = raw_handle_resize;
  75. dp->drv.get_event = raw_get_event;
  76. dp->drv.set_mouse = NULL;
  77. return 0;
  78. }
  79. #endif /* !__KERNEL__ */