source: libcaca/trunk/caca/caca_internals.h @ 692

Last change on this file since 692 was 689, checked in by Sam Hocevar, 15 years ago
  • Merged caca_show_cursor() and caca_hide_cursor() into caca_set_mouse() so that we have one function less.
  • Fixed coding style.
  • Removed FUCKING TABS. .------._

_.----' -.

_.--' `.

_.-' ' ' `. _

.- H A H A H A ' M A I S \/.)

. . .-' / `

|-.(-. ' ` |\
. '\\ V I E U X ' ' - -|

/'') - - ` ' '.' |\_)

|'_._ '' P O R C . . /
@) \ ''' . '/

/ | \)..'-. _ _ . ` '/

.'- -'. . )-- '/'' ,._`' ' /

.' - ` ' .' / ' /,;;;, ,_.---' \ / \
(. .'
',`'.--'/ ' /'-----' | ' / ))

'-'/ _.---' \;;'/ , | |`- |

'--'---' |;| / ,,,,;;;;;;;;;;,,,,, |-' / |

|;'| ,;;;;;;;;;;;;;;;; ;;;/ /|`

,,' /

'

  • Property svn:keywords set to Id
File size: 4.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 *  This library is free software; you can redistribute it and/or
7 *  modify it under the terms of the Do What The Fuck You Want To
8 *  Public License, Version 2, as published by Sam Hocevar. See
9 *  http://sam.zoy.org/wtfpl/COPYING for more details.
10 */
11
12/** \file caca_internals.h
13 *  \version \$Id: caca_internals.h 689 2006-03-24 16:51:59Z sam $
14 *  \author Sam Hocevar <sam@zoy.org>
15 *  \brief The \e libcaca private header.
16 *
17 *  This header contains the private types and functions used by \e libcaca.
18 */
19
20#ifndef __CACA_INTERNALS_H__
21#define __CACA_INTERNALS_H__
22
23#if defined(HAVE_INTTYPES_H) && !defined(__KERNEL__)
24#   include <inttypes.h>
25#elif !defined(CUSTOM_INTTYPES) && !defined(_DOXYGEN_SKIP_ME)
26#   define CUSTOM_INTTYPES
27typedef unsigned char uint8_t;
28typedef unsigned short uint16_t;
29typedef unsigned long int uint32_t;
30typedef long int intptr_t;
31typedef long unsigned int uintptr_t;
32#endif
33
34#if !defined(_DOXYGEN_SKIP_ME)
35#   define EVENTBUF_LEN 10
36#endif
37
38/* Graphics driver */
39enum caca_driver
40{
41    CACA_DRIVER_NONE = 0,
42#if defined(USE_CONIO)
43    CACA_DRIVER_CONIO = 1,
44#endif
45#if defined(USE_NCURSES)
46    CACA_DRIVER_NCURSES = 2,
47#endif
48#if defined(USE_SLANG)
49    CACA_DRIVER_SLANG = 3,
50#endif
51#if defined(USE_X11)
52    CACA_DRIVER_X11 = 4,
53#endif
54#if defined(USE_WIN32)
55    CACA_DRIVER_WIN32 = 5,
56#endif
57#if defined(USE_GL)
58    CACA_DRIVER_GL = 6,
59#endif
60#if defined(USE_NETWORK)
61    CACA_DRIVER_NETWORK = 7,
62#endif
63#if defined(USE_VGA)
64    CACA_DRIVER_VGA = 8,
65#endif
66};
67
68/* Available drivers */
69#if defined(USE_CONIO)
70int conio_install(caca_t *);
71#endif
72#if defined(USE_GL)
73int gl_install(caca_t *);
74#endif
75#if defined(USE_NCURSES)
76int ncurses_install(caca_t *);
77#endif
78#if defined(USE_SLANG)
79int slang_install(caca_t *);
80#endif
81#if defined(USE_WIN32)
82int win32_install(caca_t *);
83#endif
84#if defined(USE_X11)
85int x11_install(caca_t *);
86#endif
87#if defined(USE_NETWORK)
88int network_install(caca_t *);
89#endif
90#if defined(USE_VGA)
91int vga_install(caca_t *);
92#endif
93
94/* Timer structure */
95struct caca_timer
96{
97    int last_sec, last_usec;
98};
99
100/* Internal caca context */
101struct caca_context
102{
103    /* A link to our cucul canvas */
104    cucul_t *qq;
105
106    /* Device-specific functions */
107    struct drv
108    {
109        enum caca_driver driver;
110        struct driver_private *p;
111
112        int (* init_graphics) (caca_t *);
113        int (* end_graphics) (caca_t *);
114        int (* set_window_title) (caca_t *, char const *);
115        unsigned int (* get_window_width) (caca_t *);
116        unsigned int (* get_window_height) (caca_t *);
117        void (* display) (caca_t *);
118        void (* handle_resize) (caca_t *);
119        int (* get_event) (caca_t *, struct caca_event *);
120        void (* set_mouse) (caca_t *, int);
121    } drv;
122
123    /* Mouse position */
124    struct mouse
125    {
126        unsigned int x, y;
127    } mouse;
128
129    /* Window resize handling */
130    struct resize
131    {
132        int resized;   /* A resize event was requested */
133        unsigned w, h; /* Requested width and height */
134    } resize;
135
136    /* Framerate handling */
137    unsigned int delay, rendertime;
138    struct caca_timer timer;
139    int lastticks;
140
141    struct events
142    {
143#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
144        struct caca_event buf[EVENTBUF_LEN];
145        int queue;
146#endif
147#if defined(USE_SLANG) || defined(USE_NCURSES)
148        struct caca_timer key_timer;
149        unsigned int last_key_ticks;
150        unsigned int autorepeat_ticks;
151        struct caca_event last_key_event;
152#endif
153    } events;
154};
155
156/* Internal timer functions */
157extern void _caca_sleep(unsigned int);
158extern unsigned int _caca_getticks(struct caca_timer *);
159
160/* Internal event functions */
161extern void _caca_handle_resize(caca_t *);
162#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
163extern void _push_event(caca_t *, struct caca_event *);
164extern int _pop_event(caca_t *, struct caca_event *);
165#endif
166
167#endif /* __CACA_INTERNALS_H__ */
Note: See TracBrowser for help on using the repository browser.