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

Last change on this file since 686 was 686, checked in by Jean-Yves Lamoureux, 16 years ago
  • Added caca_show/hide_cursor, and corresponding GL binding
  • Property svn:keywords set to Id
File size: 4.0 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 *
[268]6 *  This library is free software; you can redistribute it and/or
[522]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.
[159]10 */
11
[268]12/** \file caca_internals.h
13 *  \version \$Id: caca_internals.h 686 2006-03-24 15:00:47Z jylam $
14 *  \author Sam Hocevar <sam@zoy.org>
15 *  \brief The \e libcaca private header.
[205]16 *
[268]17 *  This header contains the private types and functions used by \e libcaca.
[205]18 */
19
[193]20#ifndef __CACA_INTERNALS_H__
21#define __CACA_INTERNALS_H__
[159]22
[565]23#if defined(HAVE_INTTYPES_H) && !defined(__KERNEL__)
[540]24#   include <inttypes.h>
[565]25#elif !defined(CUSTOM_INTTYPES) && !defined(_DOXYGEN_SKIP_ME)
[543]26#   define CUSTOM_INTTYPES
[540]27typedef unsigned char uint8_t;
28typedef unsigned short uint16_t;
[573]29typedef unsigned long int uint32_t;
30typedef long int intptr_t;
31typedef long unsigned int uintptr_t;
[540]32#endif
33
[541]34#if !defined(_DOXYGEN_SKIP_ME)
35#   define EVENTBUF_LEN 10
36#endif
37
[265]38/* Graphics driver */
39enum caca_driver
40{
[684]41    CACA_DRIVER_NONE = 0,
[265]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
[335]54#if defined(USE_WIN32)
55    CACA_DRIVER_WIN32 = 5,
56#endif
[483]57#if defined(USE_GL)
58    CACA_DRIVER_GL = 6,
59#endif
[554]60#if defined(USE_NETWORK)
61    CACA_DRIVER_NETWORK = 7,
62#endif
[565]63#if defined(USE_VGA)
64    CACA_DRIVER_VGA = 8,
65#endif
[265]66};
67
[539]68/* Available drivers */
69#if defined(USE_CONIO)
[684]70int conio_install(caca_t *);
[539]71#endif
72#if defined(USE_GL)
[684]73int gl_install(caca_t *);
[539]74#endif
75#if defined(USE_NCURSES)
[684]76int ncurses_install(caca_t *);
[539]77#endif
78#if defined(USE_SLANG)
[684]79int slang_install(caca_t *);
[539]80#endif
81#if defined(USE_WIN32)
[684]82int win32_install(caca_t *);
[539]83#endif
84#if defined(USE_X11)
[684]85int x11_install(caca_t *);
[539]86#endif
[554]87#if defined(USE_NETWORK)
[684]88int network_install(caca_t *);
[554]89#endif
[565]90#if defined(USE_VGA)
[684]91int vga_install(caca_t *);
[565]92#endif
[684]93
[331]94/* Timer structure */
95struct caca_timer
96{
97    int last_sec, last_usec;
98};
99
[524]100/* Internal caca context */
101struct caca_context
102{
[551]103    /* A link to our cucul canvas */
[524]104    cucul_t *qq;
[265]105
[551]106    /* Device-specific functions */
[550]107    struct drv
[539]108    {
109        enum caca_driver driver;
[550]110        struct driver_private *p;
[539]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 *);
[553]118        void (* handle_resize) (caca_t *);
[681]119        int (* get_event) (caca_t *, struct caca_event *);
[686]120        void (* show_cursor) (caca_t *);
121        void (* hide_cursor) (caca_t *);
[550]122    } drv;
[539]123
[551]124    /* Mouse position */
125    struct mouse
126    {
127        unsigned int x, y;
128    } mouse;
[524]129
[551]130    /* Window resize handling */
[553]131    struct resize
132    {
133        int resized;   /* A resize event was requested */
134        unsigned w, h; /* Requested width and height */
135    } resize;
[524]136
[551]137    /* Framerate handling */
[524]138    unsigned int delay, rendertime;
[527]139    struct caca_timer timer;
140    int lastticks;
[524]141
[527]142    struct events
143    {
[681]144#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
145        struct caca_event buf[EVENTBUF_LEN];
[541]146        int queue;
147#endif
[527]148#if defined(USE_SLANG) || defined(USE_NCURSES)
149        struct caca_timer key_timer;
150        unsigned int last_key_ticks;
151        unsigned int autorepeat_ticks;
[681]152        struct caca_event last_key_event;
[527]153#endif
154    } events;
[524]155};
156
[645]157/* Internal timer functions */
[335]158extern void _caca_sleep(unsigned int);
[331]159extern unsigned int _caca_getticks(struct caca_timer *);
160
[645]161/* Internal event functions */
162extern void _caca_handle_resize(caca_t *);
[681]163#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
164extern void _push_event(caca_t *, struct caca_event *);
165extern int _pop_event(caca_t *, struct caca_event *);
[645]166#endif
167
[193]168#endif /* __CACA_INTERNALS_H__ */
Note: See TracBrowser for help on using the repository browser.