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

Last change on this file since 536 was 536, checked in by Sam Hocevar, 15 years ago
  • Moved stuff around to differenciate between libcucul and libcaca.
  • Property svn:keywords set to Id
File size: 3.5 KB
RevLine 
[159]1/*
[268]2 *  libcaca       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 536 2006-03-06 20:57:14Z sam $
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
[524]23#if defined(USE_X11)
24#include <X11/Xlib.h>
25#endif
26
[265]27/* Graphics driver */
28enum caca_driver
29{
30#if defined(USE_CONIO)
31    CACA_DRIVER_CONIO = 1,
32#endif
33#if defined(USE_NCURSES)
34    CACA_DRIVER_NCURSES = 2,
35#endif
36#if defined(USE_SLANG)
37    CACA_DRIVER_SLANG = 3,
38#endif
39#if defined(USE_X11)
40    CACA_DRIVER_X11 = 4,
41#endif
[335]42#if defined(USE_WIN32)
43    CACA_DRIVER_WIN32 = 5,
44#endif
[483]45#if defined(USE_GL)
46    CACA_DRIVER_GL = 6,
47#endif
[265]48    CACA_DRIVER_NONE = 0
49};
50
[331]51/* Timer structure */
52struct caca_timer
53{
54    int last_sec, last_usec;
55};
56
[524]57/* Internal caca context */
58struct caca_context
59{
60    cucul_t *qq;
[265]61
[524]62    enum caca_driver driver;
63    unsigned int width, height;
64
65    int resize;
66    int resize_event;
67
68    unsigned int delay, rendertime;
[527]69    struct caca_timer timer;
70    int lastticks;
[524]71
[527]72    struct events
73    {
74#if defined(USE_SLANG) || defined(USE_NCURSES)
75        struct caca_timer key_timer;
76        unsigned int last_key_ticks;
77        unsigned int autorepeat_ticks;
78        unsigned int last_key;
79#endif
80    } events;
81
[524]82#if defined(USE_X11) && !defined(_DOXYGEN_SKIP_ME)
83    struct x11
84    {
85        Display *dpy;
86        Window window;
87        Pixmap pixmap;
88        GC gc;
89        long int event_mask;
90        int font_width, font_height;
91        unsigned int new_width, new_height;
92        int colors[16];
93        Font font;
94        XFontStruct *font_struct;
95        int font_offset;
96#if defined(HAVE_X11_XKBLIB_H)
[527]97        Bool autorepeat;
[524]98#endif
99    } x11;
100#endif
[527]101#if defined(USE_NCURSES)
102    struct ncurses
103    {
104        int attr[16*16];
105    } ncurses;
106#endif
107#if defined(USE_CONIO)
108    struct conio
109    {
110        struct text_info ti;
111        char *screen;
112    } conio;
113#endif
114#if defined(USE_WIN32)
115    struct win32
116    {
117        HANDLE hin, hout;
118        HANDLE front, back;
119        CHAR_INFO *buffer;
120    } win32;
121#endif
122#if defined(USE_GL)
123    struct gl
124    {
125        int window;
126        unsigned int width, height;
127        float font_width, font_height;
128        float incx, incy;
129        int id[94];
130        unsigned char resized, bit;
131        unsigned char mouse_changed, mouse_clicked;
132        unsigned int mouse_x, mouse_y;
133        unsigned int mouse_button, mouse_state;
134
135        unsigned char key;
136        int special_key;
137        int new_width;
138        int new_height;
139
140        float sw, sh;
141    } gl;
142#endif
[524]143};
144
[265]145/* Initialisation functions */
[524]146extern int _caca_init_graphics(caca_t *kk);
147extern int _caca_end_graphics(caca_t *kk);
[227]148
[331]149/* Timer functions */
[335]150extern void _caca_sleep(unsigned int);
[331]151extern unsigned int _caca_getticks(struct caca_timer *);
152
[249]153/* Cached screen size */
[246]154extern unsigned int _caca_width;
155extern unsigned int _caca_height;
[349]156extern int _caca_resize;
157extern int _caca_resize_event;
[246]158
[336]159#if defined(USE_WIN32)
160#include <windows.h>
161extern HANDLE win32_hin, win32_hout;
162#endif
163
[483]164#if defined(USE_GL)
165#include <GL/glut.h>
166extern unsigned int gl_width, gl_height;
167#endif
168
169
[193]170#endif /* __CACA_INTERNALS_H__ */
Note: See TracBrowser for help on using the repository browser.