* Merged caca_show_cursor() and caca_hide_cursor() into caca_set_mouse() so
that we have one function less.
* Fixed coding style.
* Removed FUCKING TABS. ____.------.___
_______.----'`` ``` `` ``` ``-.
_.--' ` ```` ` ` ` ``` `` `` ``.
_.-' ' ` `` ``` `` ` `' `. _
.-'' ` H A H A H A `' M A I S \/.)
. . .-' / ` ` ` `` ||
|`-.(``-. ` ` ` ' ` ` ``` |\
`. '\```\ `` ` V I E U X ' ' `` `-`` -|\\
`/''````) `` ` - - ````` ' '.' |\_)
|`'_._` ``` ''` P O R C . . ```` /
// @) \ ` `` ''' . ``` '/
/''''' | ` \).`.'-. ''' _ _ .`` ` '/
.''''- `-'`. . // )-- '/,,',,' ,,,,''__,._`' ' /
.' ` `- ` ' .' / ' /,;;;, ,___.---' \ '' / \
(`. .'` __',`''''.--'/ ' /'-----' | ' / ))
`'-'/ `'''_.---' \;;|- '/ ,,, | ''|`- |
`'--'---' |;| / ,,,,;;;;;;;;;;,,,,, |-' /` |
|;|-'| ,;;;;;;;;;;;;;;;; ;;;/ /|`'''
''',,,''',,,,,,,,,,,,,,,' /,,'''
''''
18年前 |
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- /*
- * libcaca Colour ASCII-Art library
- * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org>
- * All Rights Reserved
- *
- * $Id$
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the Do What The Fuck You Want To
- * Public License, Version 2, as published by Sam Hocevar. See
- * http://sam.zoy.org/wtfpl/COPYING for more details.
- */
-
- #ifndef __CACA_INTERNALS_H__
- #define __CACA_INTERNALS_H__
-
- #if defined(HAVE_INTTYPES_H) && !defined(__KERNEL__)
- # include <inttypes.h>
- #elif !defined(CUSTOM_INTTYPES) && !defined(_DOXYGEN_SKIP_ME)
- # define CUSTOM_INTTYPES
- typedef unsigned char uint8_t;
- typedef unsigned short uint16_t;
- typedef unsigned long int uint32_t;
- typedef long int intptr_t;
- typedef long unsigned int uintptr_t;
- #endif
-
- typedef struct caca_timer caca_timer_t;
-
- #if !defined(_DOXYGEN_SKIP_ME)
- # define EVENTBUF_LEN 10
- #endif
-
- /* Graphics driver */
- enum caca_driver
- {
- CACA_DRIVER_NONE = 0,
- CACA_DRIVER_RAW = 1,
- #if defined(USE_CONIO)
- CACA_DRIVER_CONIO = 2,
- #endif
- #if defined(USE_GL)
- CACA_DRIVER_GL = 3,
- #endif
- #if defined(USE_NCURSES)
- CACA_DRIVER_NCURSES = 4,
- #endif
- #if defined(USE_SLANG)
- CACA_DRIVER_SLANG = 5,
- #endif
- #if defined(USE_VGA)
- CACA_DRIVER_VGA = 6,
- #endif
- #if defined(USE_WIN32)
- CACA_DRIVER_WIN32 = 7,
- #endif
- #if defined(USE_X11)
- CACA_DRIVER_X11 = 8,
- #endif
- };
-
- /* Available external drivers */
- #if defined(USE_CONIO)
- int conio_install(caca_t *);
- #endif
- #if defined(USE_GL)
- int gl_install(caca_t *);
- #endif
- #if defined(USE_NCURSES)
- int ncurses_install(caca_t *);
- #endif
- int raw_install(caca_t *);
- #if defined(USE_SLANG)
- int slang_install(caca_t *);
- #endif
- #if defined(USE_VGA)
- int vga_install(caca_t *);
- #endif
- #if defined(USE_WIN32)
- int win32_install(caca_t *);
- #endif
- #if defined(USE_X11)
- int x11_install(caca_t *);
- #endif
-
- /* Timer structure */
- struct caca_timer
- {
- int last_sec, last_usec;
- };
-
- /* Internal caca context */
- struct caca
- {
- /* A link to our cucul canvas */
- cucul_t *qq;
-
- /* Device-specific functions */
- struct drv
- {
- enum caca_driver driver;
- struct driver_private *p;
-
- int (* init_graphics) (caca_t *);
- int (* end_graphics) (caca_t *);
- int (* set_window_title) (caca_t *, char const *);
- unsigned int (* get_window_width) (caca_t *);
- unsigned int (* get_window_height) (caca_t *);
- void (* display) (caca_t *);
- void (* handle_resize) (caca_t *);
- int (* get_event) (caca_t *, caca_event_t *);
- void (* set_mouse) (caca_t *, int);
- } drv;
-
- /* Mouse position */
- struct mouse
- {
- unsigned int x, y;
- } mouse;
-
- /* Window resize handling */
- struct resize
- {
- int resized; /* A resize event was requested */
- unsigned w, h; /* Requested width and height */
- } resize;
-
- /* Framerate handling */
- unsigned int delay, rendertime;
- caca_timer_t timer;
- int lastticks;
-
- struct events
- {
- #if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
- caca_event_t buf[EVENTBUF_LEN];
- int queue;
- #endif
- #if defined(USE_SLANG) || defined(USE_NCURSES)
- caca_timer_t key_timer;
- unsigned int last_key_ticks;
- unsigned int autorepeat_ticks;
- caca_event_t last_key_event;
- #endif
- #if defined(USE_WIN32)
- unsigned char not_empty_struct;
- #endif
- } events;
- };
-
- /* Internal timer functions */
- extern void _caca_sleep(unsigned int);
- extern unsigned int _caca_getticks(caca_timer_t *);
-
- /* Internal event functions */
- extern void _caca_handle_resize(caca_t *);
- #if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
- extern void _push_event(caca_t *, caca_event_t *);
- extern int _pop_event(caca_t *, caca_event_t *);
- #endif
-
- #endif /* __CACA_INTERNALS_H__ */
|