source: libcaca/trunk/cpp/cpptest.cpp @ 784

Last change on this file since 784 was 784, checked in by Jean-Yves Lamoureux, 14 years ago
  • Added license in C++ files.
  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1/*
2 *  cpptest       libcaca++ rendering test
3 *  Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
4 *                All Rights Reserved
5 *
6 *  $Id: cpptest.cpp 784 2006-04-17 11:06:48Z jylam $
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
14#include <iostream>
15
16#include <cucul++.h>
17#include <caca++.h>
18
19using namespace std;
20
21
22static char const *pig[]= {
23    "                             _    ",
24    "    _._ _..._ .-',     _.._(`))   ",
25    "   '-. `     '  /-._.-'    ',/    ",
26    "      )         \            '.   ",
27    "     / _    _    |             \\  ",
28    "    |  a    a    /              | ",
29    "    \   .-.                     ; " ,
30    "     '-('' ).-'       ,'       ;  ",
31    "        '-;           |      .'   ",
32    "           \\           \\    /     ",
33    "           | 7  .__  _.-\\   \\     ",
34    "           | |  |  ``/  /`  /     ",
35    "      jgs /,_|  |   /,_/   /      ",
36    "             /,_/      '`-'       ",
37 NULL
38};
39
40int main(int argc, char *argv[])
41{
42    Cucul *qq;
43    Caca  *kk;
44    Caca::Event ev;
45
46    try {
47        qq = new Cucul();
48    }
49    catch (int e) {
50        cerr << "Error while initializing cucul (" << e << ")" << endl;
51        return -1;
52    }
53   
54    try {
55        kk = new Caca(qq);
56    }
57    catch(int e) {
58        cerr << "Error while attaching cucul to caca (" << e << ")" << endl;
59        return -1;
60    }
61
62   
63    /* Draw pig */
64    qq->set_color(CUCUL_COLOR_LIGHTMAGENTA, CUCUL_COLOR_BLACK);
65   
66    for(int i = 0; pig[i]; i++)
67        qq->putstr(0, i, (char*)pig[i]);
68   
69    /* printf works */
70    qq->set_color(CUCUL_COLOR_LIGHTBLUE, CUCUL_COLOR_BLACK); 
71    qq->printf(7,15, "Powered by libcaca %s", VERSION);
72   
73
74    kk->display();
75    kk->get_event(CACA_EVENT_KEY_PRESS, &ev, -1);
76
77
78    delete kk;
79    delete qq;
80
81    return 0;
82}
Note: See TracBrowser for help on using the repository browser.