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.
 
 
 
 
 
 

72 lines
1.6 KiB

  1. /*
  2. * truecolor truecolor canvas features
  3. * Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This program 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. #include "config.h"
  15. #include "common.h"
  16. #if !defined(__KERNEL__)
  17. # if defined(HAVE_INTTYPES_H)
  18. # include <inttypes.h>
  19. # endif
  20. # include <stdio.h>
  21. #endif
  22. #include "cucul.h"
  23. #include "caca.h"
  24. int main(int argc, char *argv[])
  25. {
  26. cucul_canvas_t *cv;
  27. caca_display_t *dp;
  28. int x, y;
  29. cv = cucul_create_canvas(32, 16);
  30. if(cv == NULL)
  31. {
  32. printf("Failed to create canvas\n");
  33. return 1;
  34. }
  35. dp = caca_create_display(cv);
  36. if(dp == NULL)
  37. {
  38. printf("Failed to create display\n");
  39. return 1;
  40. }
  41. for(y = 0; y < 16; y++)
  42. for(x = 0; x < 16; x++)
  43. {
  44. uint16_t bgcolor = 0xff00 | (y << 4) | x;
  45. uint16_t fgcolor = 0xf000 | ((15 - y) << 4) | ((15 - x) << 8);
  46. cucul_set_color_argb(cv, fgcolor, bgcolor);
  47. cucul_put_str(cv, x * 2, y, "CA");
  48. }
  49. cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_LIGHTBLUE);
  50. cucul_put_str(cv, 2, 1, " truecolor libcaca ");
  51. caca_refresh_display(dp);
  52. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  53. caca_free_display(dp);
  54. cucul_free_canvas(cv);
  55. return 0;
  56. }