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

Last change on this file since 859 was 859, checked in by Sam Hocevar, 15 years ago
  • Removed duplicate uint*_t defines from *_internal.h and included common.h in all .c files that needed it.
  • Property svn:keywords set to Id
File size: 3.7 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 859 2006-04-24 20:35:59Z sam $
7 *
[268]8 *  This library is free software; you can redistribute it and/or
[522]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.
[159]12 */
13
[193]14#ifndef __CACA_INTERNALS_H__
15#define __CACA_INTERNALS_H__
[159]16
[565]17#if defined(HAVE_INTTYPES_H) && !defined(__KERNEL__)
[540]18#   include <inttypes.h>
19#endif
20
[777]21typedef struct caca_timer caca_timer_t;
22
[541]23#if !defined(_DOXYGEN_SKIP_ME)
24#   define EVENTBUF_LEN 10
25#endif
26
[265]27/* Graphics driver */
28enum caca_driver
29{
[684]30    CACA_DRIVER_NONE = 0,
[699]31    CACA_DRIVER_RAW = 1,
[265]32#if defined(USE_CONIO)
[699]33    CACA_DRIVER_CONIO = 2,
[265]34#endif
[699]35#if defined(USE_GL)
36    CACA_DRIVER_GL = 3,
37#endif
[265]38#if defined(USE_NCURSES)
[703]39    CACA_DRIVER_NCURSES = 4,
[265]40#endif
41#if defined(USE_SLANG)
[703]42    CACA_DRIVER_SLANG = 5,
[265]43#endif
[699]44#if defined(USE_VGA)
[703]45    CACA_DRIVER_VGA = 6,
[265]46#endif
[335]47#if defined(USE_WIN32)
[703]48    CACA_DRIVER_WIN32 = 7,
[335]49#endif
[699]50#if defined(USE_X11)
[703]51    CACA_DRIVER_X11 = 8,
[483]52#endif
[265]53};
54
[699]55/* Available external drivers */
[539]56#if defined(USE_CONIO)
[811]57int conio_install(caca_display_t *);
[539]58#endif
59#if defined(USE_GL)
[811]60int gl_install(caca_display_t *);
[539]61#endif
62#if defined(USE_NCURSES)
[811]63int ncurses_install(caca_display_t *);
[539]64#endif
[811]65int raw_install(caca_display_t *);
[539]66#if defined(USE_SLANG)
[811]67int slang_install(caca_display_t *);
[539]68#endif
[699]69#if defined(USE_VGA)
[811]70int vga_install(caca_display_t *);
[699]71#endif
[539]72#if defined(USE_WIN32)
[811]73int win32_install(caca_display_t *);
[539]74#endif
75#if defined(USE_X11)
[811]76int x11_install(caca_display_t *);
[539]77#endif
[684]78
[331]79/* Timer structure */
80struct caca_timer
81{
82    int last_sec, last_usec;
83};
84
[811]85/* Internal caca display context */
86struct caca_display
[524]87{
[551]88    /* A link to our cucul canvas */
[811]89    cucul_canvas_t *cv;
[265]90
[551]91    /* Device-specific functions */
[550]92    struct drv
[539]93    {
94        enum caca_driver driver;
[550]95        struct driver_private *p;
[539]96
[811]97        int (* init_graphics) (caca_display_t *);
98        int (* end_graphics) (caca_display_t *);
[819]99        int (* set_display_title) (caca_display_t *, char const *);
100        unsigned int (* get_display_width) (caca_display_t *);
101        unsigned int (* get_display_height) (caca_display_t *);
[811]102        void (* display) (caca_display_t *);
103        void (* handle_resize) (caca_display_t *);
104        int (* get_event) (caca_display_t *, caca_event_t *);
105        void (* set_mouse) (caca_display_t *, int);
[550]106    } drv;
[539]107
[551]108    /* Mouse position */
109    struct mouse
110    {
111        unsigned int x, y;
112    } mouse;
[524]113
[551]114    /* Window resize handling */
[553]115    struct resize
116    {
117        int resized;   /* A resize event was requested */
118        unsigned w, h; /* Requested width and height */
119    } resize;
[524]120
[551]121    /* Framerate handling */
[524]122    unsigned int delay, rendertime;
[777]123    caca_timer_t timer;
[527]124    int lastticks;
[524]125
[527]126    struct events
127    {
[681]128#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
[777]129        caca_event_t buf[EVENTBUF_LEN];
[541]130        int queue;
131#endif
[527]132#if defined(USE_SLANG) || defined(USE_NCURSES)
[777]133        caca_timer_t key_timer;
[527]134        unsigned int last_key_ticks;
135        unsigned int autorepeat_ticks;
[777]136        caca_event_t last_key_event;
[527]137#endif
[775]138#if defined(USE_WIN32)
139                unsigned char not_empty_struct;
140#endif
[527]141    } events;
[524]142};
143
[645]144/* Internal timer functions */
[335]145extern void _caca_sleep(unsigned int);
[777]146extern unsigned int _caca_getticks(caca_timer_t *);
[331]147
[645]148/* Internal event functions */
[811]149extern void _caca_handle_resize(caca_display_t *);
[681]150#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
[811]151extern void _push_event(caca_display_t *, caca_event_t *);
152extern int _pop_event(caca_display_t *, caca_event_t *);
[645]153#endif
154
[193]155#endif /* __CACA_INTERNALS_H__ */
Note: See TracBrowser for help on using the repository browser.