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

110 строки
2.1 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 Cocoa input and output driver
  15. */
  16. #include "config.h"
  17. #include "common.h"
  18. #if defined USE_COCOA
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <Cocoa/Cocoa.h>
  22. #include "caca.h"
  23. #include "caca_internals.h"
  24. #include "cucul.h"
  25. #include "cucul_internals.h"
  26. struct driver_private
  27. {
  28. /* Just testing stuff */
  29. NSAutoreleasePool *pool;
  30. };
  31. static int cocoa_init_graphics(caca_display_t *dp)
  32. {
  33. dp->drv.p = malloc(sizeof(struct driver_private));
  34. dp->drv.p->pool = [NSAutoreleasePool new];
  35. return 0;
  36. }
  37. static int cocoa_end_graphics(caca_display_t *dp)
  38. {
  39. [dp->drv.p->pool release];
  40. free(dp->drv.p);
  41. return 0;
  42. }
  43. static int cocoa_set_display_title(caca_display_t *dp, char const *title)
  44. {
  45. return -1;
  46. }
  47. static unsigned int cocoa_get_display_width(caca_display_t *dp)
  48. {
  49. return 0;
  50. }
  51. static unsigned int cocoa_get_display_height(caca_display_t *dp)
  52. {
  53. return 0;
  54. }
  55. static void cocoa_display(caca_display_t *dp)
  56. {
  57. ;
  58. }
  59. static void cocoa_handle_resize(caca_display_t *dp)
  60. {
  61. ;
  62. }
  63. static int cocoa_get_event(caca_display_t *dp, caca_event_t *ev)
  64. {
  65. ev->type = CACA_EVENT_NONE;
  66. return 0;
  67. }
  68. /*
  69. * Driver initialisation
  70. */
  71. int cocoa_install(caca_display_t *dp)
  72. {
  73. dp->drv.driver = CACA_DRIVER_RAW;
  74. dp->drv.init_graphics = cocoa_init_graphics;
  75. dp->drv.end_graphics = cocoa_end_graphics;
  76. dp->drv.set_display_title = cocoa_set_display_title;
  77. dp->drv.get_display_width = cocoa_get_display_width;
  78. dp->drv.get_display_height = cocoa_get_display_height;
  79. dp->drv.display = cocoa_display;
  80. dp->drv.handle_resize = cocoa_handle_resize;
  81. dp->drv.get_event = cocoa_get_event;
  82. dp->drv.set_mouse = NULL;
  83. return 0;
  84. }
  85. #endif /* USE_COCOA */