source: libcaca/trunk/src/cacaplay.c @ 1308

Last change on this file since 1308 was 1308, checked in by Sam Hocevar, 14 years ago
  • Convert all programs and tests to the new import/export API.
  • Property svn:keywords set to Id
File size: 1.2 KB
Line 
1/*
2 *  cacaplay      caca file player
3 *  Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
4 *                All Rights Reserved
5 *
6 *  $Id: cacaplay.c 1308 2006-11-08 17:26:57Z sam $
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 "config.h"
15#include "common.h"
16
17#if !defined(__KERNEL__)
18  #include <stdio.h>
19  #include <stdlib.h>
20#endif
21
22#include "cucul.h"
23#include "caca.h"
24
25int main(int argc, char **argv)
26{
27    caca_event_t ev;
28    cucul_canvas_t *cv;
29    caca_display_t *dp;
30
31    if(argc < 2)
32    {
33        fprintf(stderr, "%s: missing argument (filename).\n", argv[0]);
34        return 1;
35    }
36
37    cv = cucul_create_canvas(0, 0);
38    if(cucul_import_file(cv, argv[1], "caca") < 0)
39    {
40        fprintf(stderr, "%s: could not import file %s.\n", argv[0], argv[1]);
41        return 1;
42    }
43
44    dp = caca_create_display(cv);
45
46    caca_refresh_display(dp);
47
48    while(caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1))
49    {
50        if(ev.data.key.ch == CACA_KEY_ESCAPE)
51            break;
52    }
53
54    /* Clean up */
55    caca_free_display(dp);
56    cucul_free_canvas(cv);
57
58    return 0;
59}
60
Note: See TracBrowser for help on using the repository browser.