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

Last change on this file since 769 was 769, checked in by Sam Hocevar, 15 years ago
  • Removed \file directives from all files except caca.h and cucul.h, to remove redundencies in the Doxygen documentation.
  • 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 769 2006-04-14 07:30:53Z 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>
[565]19#elif !defined(CUSTOM_INTTYPES) && !defined(_DOXYGEN_SKIP_ME)
[543]20#   define CUSTOM_INTTYPES
[540]21typedef unsigned char uint8_t;
22typedef unsigned short uint16_t;
[573]23typedef unsigned long int uint32_t;
24typedef long int intptr_t;
25typedef long unsigned int uintptr_t;
[540]26#endif
27
[541]28#if !defined(_DOXYGEN_SKIP_ME)
29#   define EVENTBUF_LEN 10
30#endif
31
[265]32/* Graphics driver */
33enum caca_driver
34{
[684]35    CACA_DRIVER_NONE = 0,
[699]36    CACA_DRIVER_RAW = 1,
[265]37#if defined(USE_CONIO)
[699]38    CACA_DRIVER_CONIO = 2,
[265]39#endif
[699]40#if defined(USE_GL)
41    CACA_DRIVER_GL = 3,
42#endif
[265]43#if defined(USE_NCURSES)
[703]44    CACA_DRIVER_NCURSES = 4,
[265]45#endif
46#if defined(USE_SLANG)
[703]47    CACA_DRIVER_SLANG = 5,
[265]48#endif
[699]49#if defined(USE_VGA)
[703]50    CACA_DRIVER_VGA = 6,
[265]51#endif
[335]52#if defined(USE_WIN32)
[703]53    CACA_DRIVER_WIN32 = 7,
[335]54#endif
[699]55#if defined(USE_X11)
[703]56    CACA_DRIVER_X11 = 8,
[483]57#endif
[265]58};
59
[699]60/* Available external drivers */
[539]61#if defined(USE_CONIO)
[684]62int conio_install(caca_t *);
[539]63#endif
64#if defined(USE_GL)
[684]65int gl_install(caca_t *);
[539]66#endif
67#if defined(USE_NCURSES)
[684]68int ncurses_install(caca_t *);
[539]69#endif
[699]70int raw_install(caca_t *);
[539]71#if defined(USE_SLANG)
[684]72int slang_install(caca_t *);
[539]73#endif
[699]74#if defined(USE_VGA)
75int vga_install(caca_t *);
76#endif
[539]77#if defined(USE_WIN32)
[684]78int win32_install(caca_t *);
[539]79#endif
80#if defined(USE_X11)
[684]81int x11_install(caca_t *);
[539]82#endif
[684]83
[331]84/* Timer structure */
85struct caca_timer
86{
87    int last_sec, last_usec;
88};
89
[524]90/* Internal caca context */
91struct caca_context
92{
[551]93    /* A link to our cucul canvas */
[524]94    cucul_t *qq;
[265]95
[551]96    /* Device-specific functions */
[550]97    struct drv
[539]98    {
99        enum caca_driver driver;
[550]100        struct driver_private *p;
[539]101
102        int (* init_graphics) (caca_t *);
103        int (* end_graphics) (caca_t *);
104        int (* set_window_title) (caca_t *, char const *);
105        unsigned int (* get_window_width) (caca_t *);
106        unsigned int (* get_window_height) (caca_t *);
107        void (* display) (caca_t *);
[553]108        void (* handle_resize) (caca_t *);
[681]109        int (* get_event) (caca_t *, struct caca_event *);
[689]110        void (* set_mouse) (caca_t *, int);
[550]111    } drv;
[539]112
[551]113    /* Mouse position */
114    struct mouse
115    {
116        unsigned int x, y;
117    } mouse;
[524]118
[551]119    /* Window resize handling */
[553]120    struct resize
121    {
122        int resized;   /* A resize event was requested */
123        unsigned w, h; /* Requested width and height */
124    } resize;
[524]125
[551]126    /* Framerate handling */
[524]127    unsigned int delay, rendertime;
[527]128    struct caca_timer timer;
129    int lastticks;
[524]130
[527]131    struct events
132    {
[681]133#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
134        struct caca_event buf[EVENTBUF_LEN];
[541]135        int queue;
136#endif
[527]137#if defined(USE_SLANG) || defined(USE_NCURSES)
138        struct caca_timer key_timer;
139        unsigned int last_key_ticks;
140        unsigned int autorepeat_ticks;
[681]141        struct caca_event last_key_event;
[527]142#endif
143    } events;
[524]144};
145
[645]146/* Internal timer functions */
[335]147extern void _caca_sleep(unsigned int);
[331]148extern unsigned int _caca_getticks(struct caca_timer *);
149
[645]150/* Internal event functions */
151extern void _caca_handle_resize(caca_t *);
[681]152#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
153extern void _push_event(caca_t *, struct caca_event *);
154extern int _pop_event(caca_t *, struct caca_event *);
[645]155#endif
156
[193]157#endif /* __CACA_INTERNALS_H__ */
Note: See TracBrowser for help on using the repository browser.