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

Last change on this file since 2043 was 2043, checked in by Sam Hocevar, 13 years ago
  • Added as many "const" qualifiers as possible to the public API.
  • Property svn:keywords set to Id
File size: 4.1 KB
RevLine 
[159]1/*
[672]2 *  libcaca       Colour ASCII-Art library
[527]3 *  Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org>
[268]4 *                All Rights Reserved
[159]5 *
[769]6 *  $Id: caca_internals.h 2043 2007-11-24 11:08:21Z sam $
7 *
[1462]8 *  This library is free software. It comes without any warranty, to
[1452]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
[522]12 *  http://sam.zoy.org/wtfpl/COPYING for more details.
[159]13 */
14
[193]15#ifndef __CACA_INTERNALS_H__
16#define __CACA_INTERNALS_H__
[159]17
[565]18#if defined(HAVE_INTTYPES_H) && !defined(__KERNEL__)
[540]19#   include <inttypes.h>
20#endif
21
[777]22typedef struct caca_timer caca_timer_t;
23
[541]24#if !defined(_DOXYGEN_SKIP_ME)
25#   define EVENTBUF_LEN 10
26#endif
27
[265]28/* Graphics driver */
29enum caca_driver
30{
[684]31    CACA_DRIVER_NONE = 0,
[699]32    CACA_DRIVER_RAW = 1,
[1396]33#if defined(USE_COCOA)
34    CACA_DRIVER_COCOA = 2,
35#endif
[265]36#if defined(USE_CONIO)
[1396]37    CACA_DRIVER_CONIO = 3,
[265]38#endif
[699]39#if defined(USE_GL)
[1396]40    CACA_DRIVER_GL = 4,
[699]41#endif
[265]42#if defined(USE_NCURSES)
[1396]43    CACA_DRIVER_NCURSES = 5,
[265]44#endif
45#if defined(USE_SLANG)
[1396]46    CACA_DRIVER_SLANG = 6,
[265]47#endif
[699]48#if defined(USE_VGA)
[1396]49    CACA_DRIVER_VGA = 7,
[265]50#endif
[335]51#if defined(USE_WIN32)
[1396]52    CACA_DRIVER_WIN32 = 8,
[335]53#endif
[699]54#if defined(USE_X11)
[1396]55    CACA_DRIVER_X11 = 9,
[483]56#endif
[265]57};
58
[699]59/* Available external drivers */
[1396]60#if defined(USE_COCOA)
61int cocoa_install(caca_display_t *);
62#endif
[539]63#if defined(USE_CONIO)
[811]64int conio_install(caca_display_t *);
[539]65#endif
66#if defined(USE_GL)
[811]67int gl_install(caca_display_t *);
[539]68#endif
69#if defined(USE_NCURSES)
[811]70int ncurses_install(caca_display_t *);
[539]71#endif
[811]72int raw_install(caca_display_t *);
[539]73#if defined(USE_SLANG)
[811]74int slang_install(caca_display_t *);
[539]75#endif
[699]76#if defined(USE_VGA)
[811]77int vga_install(caca_display_t *);
[699]78#endif
[539]79#if defined(USE_WIN32)
[811]80int win32_install(caca_display_t *);
[539]81#endif
82#if defined(USE_X11)
[811]83int x11_install(caca_display_t *);
[539]84#endif
[684]85
[331]86/* Timer structure */
87struct caca_timer
88{
89    int last_sec, last_usec;
90};
91
[811]92/* Internal caca display context */
93struct caca_display
[524]94{
[551]95    /* A link to our cucul canvas */
[811]96    cucul_canvas_t *cv;
[265]97
[1208]98#if defined(USE_PLUGINS)
99    void *plugin;
100#endif
101
[551]102    /* Device-specific functions */
[550]103    struct drv
[539]104    {
105        enum caca_driver driver;
[550]106        struct driver_private *p;
[539]107
[811]108        int (* init_graphics) (caca_display_t *);
109        int (* end_graphics) (caca_display_t *);
[819]110        int (* set_display_title) (caca_display_t *, char const *);
[2043]111        unsigned int (* get_display_width) (caca_display_t const *);
112        unsigned int (* get_display_height) (caca_display_t const *);
[811]113        void (* display) (caca_display_t *);
114        void (* handle_resize) (caca_display_t *);
115        int (* get_event) (caca_display_t *, caca_event_t *);
116        void (* set_mouse) (caca_display_t *, int);
[1430]117        void (* set_cursor) (caca_display_t *, int);
[550]118    } drv;
[539]119
[551]120    /* Mouse position */
121    struct mouse
122    {
123        unsigned int x, y;
124    } mouse;
[524]125
[551]126    /* Window resize handling */
[553]127    struct resize
128    {
129        int resized;   /* A resize event was requested */
130        unsigned w, h; /* Requested width and height */
131    } resize;
[524]132
[551]133    /* Framerate handling */
[524]134    unsigned int delay, rendertime;
[777]135    caca_timer_t timer;
[527]136    int lastticks;
[524]137
[527]138    struct events
139    {
[681]140#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
[777]141        caca_event_t buf[EVENTBUF_LEN];
[541]142        int queue;
143#endif
[527]144#if defined(USE_SLANG) || defined(USE_NCURSES)
[777]145        caca_timer_t key_timer;
[527]146        unsigned int last_key_ticks;
147        unsigned int autorepeat_ticks;
[777]148        caca_event_t last_key_event;
[527]149#endif
[775]150#if defined(USE_WIN32)
[978]151        unsigned char not_empty_struct;
[775]152#endif
[527]153    } events;
[524]154};
155
[645]156/* Internal timer functions */
[335]157extern void _caca_sleep(unsigned int);
[777]158extern unsigned int _caca_getticks(caca_timer_t *);
[331]159
[645]160/* Internal event functions */
[811]161extern void _caca_handle_resize(caca_display_t *);
[681]162#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
[811]163extern void _push_event(caca_display_t *, caca_event_t *);
164extern int _pop_event(caca_display_t *, caca_event_t *);
[645]165#endif
166
[1392]167/* Internal window functions */
168extern void _caca_set_term_title(char const *);
169
[193]170#endif /* __CACA_INTERNALS_H__ */
Note: See TracBrowser for help on using the repository browser.