source: libcaca/trunk/test/blit.c @ 1462

Last change on this file since 1462 was 1462, checked in by Sam Hocevar, 13 years ago
  • Bwarf, typo in the no warranty clause.
  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1/*
2 *  blit          libcaca blit test program
3 *  Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
4 *                All Rights Reserved
5 *
6 *  $Id: blit.c 1462 2006-12-12 01:53:54Z sam $
7 *
8 *  This program is free software. It comes without any warranty, to
9 *  the extent permitted by applicable law. You can redistribute it
10 *  and/or modify it under the terms of the Do What The Fuck You Want
11 *  To Public License, Version 2, as published by Sam Hocevar. See
12 *  http://sam.zoy.org/wtfpl/COPYING for more details.
13 */
14
15#include "config.h"
16#include "common.h"
17#if !defined(__KERNEL__)
18#   include <stdio.h>
19#   include <string.h>
20#endif
21
22#include "cucul.h"
23#include "caca.h"
24
25static char const pig[] =
26    "  ,__         __,\n"
27    "   \\)`\\_..._/`(/\n"
28    "   .'  _   _  '.\n"
29    "  /    o\\ /o   \\\n"
30    "  |    .-.-.    |  _\n"
31    "  |   /() ()\\   | (,`)\n"
32    " / \\  '-----'  / \\ .'\n"
33    "|   '-..___..-'   |\n"
34    "|                 |\n"
35    "|                 |\n"
36    ";                 ;\n"
37    " \\      / \\      /\n"
38    "  \\-..-/'-'\\-..-/\n"
39    "jgs\\/\\/     \\/\\/\n";
40
41int main(int argc, char *argv[])
42{
43    cucul_canvas_t *cv, *sprite;
44    caca_display_t *dp;
45
46    cv = cucul_create_canvas(0, 0);
47    dp = caca_create_display(cv);
48
49    sprite = cucul_create_canvas(0, 0);
50    cucul_set_color_ansi(sprite, CUCUL_LIGHTRED, CUCUL_BLACK);
51    cucul_import_memory(sprite, pig, strlen(pig), "text");
52    cucul_set_canvas_handle(sprite, cucul_get_canvas_width(sprite) / 2,
53                                    cucul_get_canvas_height(sprite) / 2);
54
55    cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE);
56    cucul_put_str(cv, 0, 0, "Centered sprite");
57
58    cucul_blit(cv, cucul_get_canvas_width(cv) / 2,
59                   cucul_get_canvas_height(cv) / 2, sprite, NULL);
60
61    caca_refresh_display(dp);
62
63    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
64
65    caca_free_display(dp);
66    cucul_free_canvas(sprite);
67    cucul_free_canvas(cv);
68
69    return 0;
70}
71
Note: See TracBrowser for help on using the repository browser.