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

Last change on this file since 632 was 573, checked in by Sam Hocevar, 14 years ago
  • Added assembly code for inb() and outb().
  • Print a small message at kernel boot time just to check that the kernel was properly loaded.
  • Property svn:keywords set to Id
File size: 3.7 KB
Line 
1/*
2 *  libcaca       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 573 2006-03-09 15:35:00Z 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#if defined(USE_CONIO)
42    CACA_DRIVER_CONIO = 1,
43#endif
44#if defined(USE_NCURSES)
45    CACA_DRIVER_NCURSES = 2,
46#endif
47#if defined(USE_SLANG)
48    CACA_DRIVER_SLANG = 3,
49#endif
50#if defined(USE_X11)
51    CACA_DRIVER_X11 = 4,
52#endif
53#if defined(USE_WIN32)
54    CACA_DRIVER_WIN32 = 5,
55#endif
56#if defined(USE_GL)
57    CACA_DRIVER_GL = 6,
58#endif
59#if defined(USE_NETWORK)
60    CACA_DRIVER_NETWORK = 7,
61#endif
62#if defined(USE_VGA)
63    CACA_DRIVER_VGA = 8,
64#endif
65    CACA_DRIVER_NONE = 0
66};
67
68/* Available drivers */
69#if defined(USE_CONIO)
70void conio_init_driver(caca_t *);
71#endif
72#if defined(USE_GL)
73void gl_init_driver(caca_t *);
74#endif
75#if defined(USE_NCURSES)
76void ncurses_init_driver(caca_t *);
77#endif
78#if defined(USE_SLANG)
79void slang_init_driver(caca_t *);
80#endif
81#if defined(USE_WIN32)
82void win32_init_driver(caca_t *);
83#endif
84#if defined(USE_X11)
85void x11_init_driver(caca_t *);
86#endif
87#if defined(USE_NETWORK)
88void network_init_driver(caca_t *);
89#endif
90#if defined(USE_VGA)
91void vga_init_driver(caca_t *);
92#endif
93/* Timer structure */
94struct caca_timer
95{
96    int last_sec, last_usec;
97};
98
99/* Internal caca context */
100struct caca_context
101{
102    /* A link to our cucul canvas */
103    cucul_t *qq;
104
105    /* Device-specific functions */
106    struct drv
107    {
108        enum caca_driver driver;
109        struct driver_private *p;
110
111        int (* init_graphics) (caca_t *);
112        int (* end_graphics) (caca_t *);
113        int (* set_window_title) (caca_t *, char const *);
114        unsigned int (* get_window_width) (caca_t *);
115        unsigned int (* get_window_height) (caca_t *);
116        void (* display) (caca_t *);
117        void (* handle_resize) (caca_t *);
118        unsigned int (* get_event) (caca_t *);
119    } drv;
120
121    /* Mouse position */
122    struct mouse
123    {
124        unsigned int x, y;
125    } mouse;
126
127    /* Window resize handling */
128    struct resize
129    {
130        int resized;   /* A resize event was requested */
131        //int acked;     /* The event has been acknowledged by the user */
132        unsigned w, h; /* Requested width and height */
133    } resize;
134
135    /* Framerate handling */
136    unsigned int delay, rendertime;
137    struct caca_timer timer;
138    int lastticks;
139
140    struct events
141    {
142#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO)
143        unsigned int buf[EVENTBUF_LEN];
144        int queue;
145#endif
146#if defined(USE_SLANG) || defined(USE_NCURSES)
147        struct caca_timer key_timer;
148        unsigned int last_key_ticks;
149        unsigned int autorepeat_ticks;
150        unsigned int last_key;
151#endif
152    } events;
153};
154
155/* Timer functions */
156extern void _caca_sleep(unsigned int);
157extern unsigned int _caca_getticks(struct caca_timer *);
158
159#endif /* __CACA_INTERNALS_H__ */
Note: See TracBrowser for help on using the repository browser.