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.
 
 
 
 
 
 

58 lines
1.2 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_t *qq;
  27. caca_t *kk;
  28. int x, y;
  29. qq = cucul_create(32, 16);
  30. kk = caca_attach(qq);
  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(qq, fgcolor, bgcolor);
  37. cucul_putstr(qq, x * 2, y, "CA");
  38. }
  39. caca_display(kk);
  40. caca_get_event(kk, CACA_EVENT_KEY_PRESS, &ev, -1);
  41. caca_detach(kk);
  42. cucul_free(qq);
  43. return 0;
  44. }