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.
 
 
 
 
 
 

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