83 lines
1.9 KiB

  1. /*
  2. * cpptest libcaca++ rendering test
  3. * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.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 <iostream>
  14. #include <cucul++.h>
  15. #include <caca++.h>
  16. using namespace std;
  17. static char const *pig[]= {
  18. " _ ",
  19. " _._ _..._ .-', _.._(`)) ",
  20. " '-. ` ' /-._.-' ',/ ",
  21. " ) \ '. ",
  22. " / _ _ | \\ ",
  23. " | a a / | ",
  24. " \ .-. ; " ,
  25. " '-('' ).-' ,' ; ",
  26. " '-; | .' ",
  27. " \\ \\ / ",
  28. " | 7 .__ _.-\\ \\ ",
  29. " | | | ``/ /` / ",
  30. " jgs /,_| | /,_/ / ",
  31. " /,_/ '`-' ",
  32. NULL
  33. };
  34. int main(int argc, char *argv[])
  35. {
  36. Cucul *qq;
  37. Caca *kk;
  38. Caca::Event ev;
  39. try {
  40. qq = new Cucul();
  41. }
  42. catch (int e) {
  43. cerr << "Error while initializing cucul (" << e << ")" << endl;
  44. return -1;
  45. }
  46. try {
  47. kk = new Caca(qq);
  48. }
  49. catch(int e) {
  50. cerr << "Error while attaching cucul to caca (" << e << ")" << endl;
  51. return -1;
  52. }
  53. /* Draw pig */
  54. qq->set_color(CUCUL_COLOR_LIGHTMAGENTA, CUCUL_COLOR_BLACK);
  55. for(int i = 0; pig[i]; i++)
  56. qq->putstr(0, i, (char*)pig[i]);
  57. /* printf works */
  58. qq->set_color(CUCUL_COLOR_LIGHTBLUE, CUCUL_COLOR_BLACK);
  59. qq->printf(7,15, "Powered by libcaca %s", VERSION);
  60. kk->display();
  61. kk->get_event(CACA_EVENT_KEY_PRESS, &ev, -1);
  62. delete kk;
  63. delete qq;
  64. return 0;
  65. }