source: libcaca/trunk/caca/driver_raw.c @ 818

Last change on this file since 818 was 818, checked in by Sam Hocevar, 15 years ago
  • Added a new "caca" exporter.
  • Removed most code from the raw driver and replaced it with a call to the caca exporter.
  • Slightly changed the caca export format and updated code accordingly.
  • Improved cacaserver error reporting.
  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1/*
2 *  libcaca       Colour ASCII-Art library
3 *  Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org>
4 *                All Rights Reserved
5 *
6 *  $Id: driver_raw.c 818 2006-04-19 09:07:55Z sam $
7 *
8 *  This library 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/*
15 *  This file contains the libcaca raw input and output driver
16 */
17
18#include "config.h"
19
20#if !defined(__KERNEL__)
21#   include <stdio.h>
22#endif
23
24#include "caca.h"
25#include "caca_internals.h"
26#include "cucul.h"
27#include "cucul_internals.h"
28
29static int raw_init_graphics(caca_display_t *dp)
30{
31    return 0;
32}
33
34static int raw_end_graphics(caca_display_t *dp)
35{
36    return 0;
37}
38
39static int raw_set_window_title(caca_display_t *dp, char const *title)
40{
41    return 0;
42}
43
44static unsigned int raw_get_window_width(caca_display_t *dp)
45{
46    return 0;
47}
48
49static unsigned int raw_get_window_height(caca_display_t *dp)
50{
51    return 0;
52}
53
54static void raw_display(caca_display_t *dp)
55{
56    cucul_buffer_t *buffer;
57
58    buffer = cucul_create_export(dp->cv, "caca");
59    fwrite(cucul_get_buffer_data(buffer),
60           cucul_get_buffer_size(buffer), 1, stdout);
61    fflush(stdout);
62    cucul_free_buffer(buffer);
63}
64
65static void raw_handle_resize(caca_display_t *dp)
66{
67    ;
68}
69
70static int raw_get_event(caca_display_t *dp, caca_event_t *ev)
71{
72    ev->type = CACA_EVENT_NONE;
73    return 0;
74}
75
76/*
77 * Driver initialisation
78 */
79
80int raw_install(caca_display_t *dp)
81{
82    dp->drv.driver = CACA_DRIVER_RAW;
83
84    dp->drv.init_graphics = raw_init_graphics;
85    dp->drv.end_graphics = raw_end_graphics;
86    dp->drv.set_window_title = raw_set_window_title;
87    dp->drv.get_window_width = raw_get_window_width;
88    dp->drv.get_window_height = raw_get_window_height;
89    dp->drv.display = raw_display;
90    dp->drv.handle_resize = raw_handle_resize;
91    dp->drv.get_event = raw_get_event;
92    dp->drv.set_mouse = NULL;
93
94    return 0;
95}
96
Note: See TracBrowser for help on using the repository browser.