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.
 
 
 
 
 
 

59 lines
1.3 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; 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. #include "config.h"
  14. #include "common.h"
  15. #if defined(HAVE_INTTYPES_H)
  16. # include <inttypes.h>
  17. #endif
  18. #include <stdio.h>
  19. #include "cucul.h"
  20. #include "caca.h"
  21. int main(void)
  22. {
  23. cucul_canvas_t *cv;
  24. caca_display_t *dp;
  25. int x, y;
  26. cv = cucul_create_canvas(32, 16);
  27. dp = caca_create_display(cv);
  28. for(y = 0; y < 16; y++)
  29. for(x = 0; x < 16; x++)
  30. {
  31. uint16_t bgcolor = 0xff00 | (y << 4) | x;
  32. uint16_t fgcolor = 0xf000 | ((15 - y) << 4) | ((15 - x) << 8);
  33. cucul_set_truecolor(cv, fgcolor, bgcolor);
  34. cucul_putstr(cv, x * 2, y, "CA");
  35. }
  36. cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_LIGHTBLUE);
  37. cucul_putstr(cv, 2, 1, " truecolor libcaca ");
  38. caca_refresh_display(dp);
  39. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  40. caca_free_display(dp);
  41. cucul_free_canvas(cv);
  42. return 0;
  43. }