Last change
on this file since 1275 was
1048,
checked in by Jean-Yves Lamoureux, 16 years ago
|
- Updated kernel 'driver', still not working, but most of the work is done
|
-
Property svn:keywords set to
Id
|
File size:
1.4 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 1048 2006-09-17 12:44:18Z 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 "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 | |
---|
25 | int main(int argc, char **argv) |
---|
26 | { |
---|
27 | caca_event_t ev; |
---|
28 | cucul_buffer_t *b; |
---|
29 | cucul_canvas_t *cv; |
---|
30 | caca_display_t *dp; |
---|
31 | |
---|
32 | if(argc < 2) |
---|
33 | { |
---|
34 | fprintf(stderr, "%s: missing argument (filename).\n", argv[0]); |
---|
35 | return 1; |
---|
36 | } |
---|
37 | |
---|
38 | b = cucul_load_file(argv[1]); |
---|
39 | if(!b) |
---|
40 | { |
---|
41 | fprintf(stderr, "%s: could not open %s.\n", argv[0], argv[1]); |
---|
42 | return 1; |
---|
43 | } |
---|
44 | |
---|
45 | cv = cucul_import_canvas(b, "caca"); |
---|
46 | if(!cv) |
---|
47 | { |
---|
48 | fprintf(stderr, "%s: invalid caca file %s.\n", argv[0], argv[1]); |
---|
49 | cucul_free_buffer(b); |
---|
50 | return 1; |
---|
51 | } |
---|
52 | |
---|
53 | cucul_free_buffer(b); |
---|
54 | |
---|
55 | dp = caca_create_display(cv); |
---|
56 | |
---|
57 | caca_refresh_display(dp); |
---|
58 | |
---|
59 | while(caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1)) |
---|
60 | { |
---|
61 | if(ev.data.key.ch == CACA_KEY_ESCAPE) |
---|
62 | break; |
---|
63 | } |
---|
64 | |
---|
65 | /* Clean up */ |
---|
66 | caca_free_display(dp); |
---|
67 | cucul_free_canvas(cv); |
---|
68 | |
---|
69 | return 0; |
---|
70 | } |
---|
71 | |
---|
Note: See
TracBrowser
for help on using the repository browser.