Ignore:
Timestamp:
Apr 16, 2006, 8:28:47 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Replaced "struct cucul_*" and "struct caca_*" types with opaque typedefs such as cucul_dither_t instead of struct cucul_dither.
  • Made cucul_buffer_t an opaque structure and implemented the two getters cucul_get_buffer_data() and cucul_get_buffer_size().
  • Documented all missing functions and function parameters.
Location:
libcaca/trunk/caca
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/caca.h

    r773 r777  
    8888#endif
    8989
    90 /** \brief User event types.
    91  *
    92  *  Event types returned by caca_get_event().
    93  */
    94 enum caca_event_type
    95 {
    96     CACA_EVENT_NONE =          0x0000, /**< No event. */
    97 
    98     CACA_EVENT_KEY_PRESS =     0x0001, /**< A key was pressed. */
    99     CACA_EVENT_KEY_RELEASE =   0x0002, /**< A key was released. */
    100     CACA_EVENT_MOUSE_PRESS =   0x0004, /**< A mouse button was pressed. */
    101     CACA_EVENT_MOUSE_RELEASE = 0x0008, /**< A mouse button was released. */
    102     CACA_EVENT_MOUSE_MOTION =  0x0010, /**< The mouse was moved. */
    103     CACA_EVENT_RESIZE =        0x0020, /**< The window was resized. */
    104 
    105     CACA_EVENT_ANY =           0xffff  /**< Bitmask for any event. */
    106 };
     90/** \e libcaca context */
     91typedef struct caca caca_t;
     92/** event structure */
     93typedef struct caca_event caca_event_t;
    10794
    10895/** \brief User events.
     
    139126struct caca_event
    140127{
    141     enum caca_event_type type;
     128    enum caca_event_type
     129    {
     130        CACA_EVENT_NONE =          0x0000, /**< No event. */
     131
     132        CACA_EVENT_KEY_PRESS =     0x0001, /**< A key was pressed. */
     133        CACA_EVENT_KEY_RELEASE =   0x0002, /**< A key was released. */
     134        CACA_EVENT_MOUSE_PRESS =   0x0004, /**< A mouse button was pressed. */
     135        CACA_EVENT_MOUSE_RELEASE = 0x0008, /**< A mouse button was released. */
     136        CACA_EVENT_MOUSE_MOTION =  0x0010, /**< The mouse was moved. */
     137        CACA_EVENT_RESIZE =        0x0020, /**< The window was resized. */
     138
     139        CACA_EVENT_ANY =           0xffff  /**< Bitmask for any event. */
     140    } type;
     141
    142142    union
    143143    {
     
    195195};
    196196
    197 typedef struct caca_context caca_t;
    198 
    199 /** \defgroup basic Basic functions
     197/** \defgroup caca Basic libcaca functions
    200198 *
    201199 *  These functions provide the basic \e libcaca routines for driver
     
    219217 *
    220218 *  @{ */
    221 int caca_get_event(caca_t *kk, unsigned int, struct caca_event *, int);
     219int caca_get_event(caca_t *kk, unsigned int, caca_event_t *, int);
    222220unsigned int caca_get_mouse_x(caca_t *kk);
    223221unsigned int caca_get_mouse_y(caca_t *kk);
  • libcaca/trunk/caca/caca_internals.h

    r775 r777  
    2525typedef long unsigned int uintptr_t;
    2626#endif
     27
     28typedef struct caca_timer caca_timer_t;
    2729
    2830#if !defined(_DOXYGEN_SKIP_ME)
     
    8991
    9092/* Internal caca context */
    91 struct caca_context
     93struct caca
    9294{
    9395    /* A link to our cucul canvas */
     
    107109        void (* display) (caca_t *);
    108110        void (* handle_resize) (caca_t *);
    109         int (* get_event) (caca_t *, struct caca_event *);
     111        int (* get_event) (caca_t *, caca_event_t *);
    110112        void (* set_mouse) (caca_t *, int);
    111113    } drv;
     
    126128    /* Framerate handling */
    127129    unsigned int delay, rendertime;
    128     struct caca_timer timer;
     130    caca_timer_t timer;
    129131    int lastticks;
    130132
     
    132134    {
    133135#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
    134         struct caca_event buf[EVENTBUF_LEN];
     136        caca_event_t buf[EVENTBUF_LEN];
    135137        int queue;
    136138#endif
    137139#if defined(USE_SLANG) || defined(USE_NCURSES)
    138         struct caca_timer key_timer;
     140        caca_timer_t key_timer;
    139141        unsigned int last_key_ticks;
    140142        unsigned int autorepeat_ticks;
    141         struct caca_event last_key_event;
     143        caca_event_t last_key_event;
    142144#endif
    143145#if defined(USE_WIN32)
     
    149151/* Internal timer functions */
    150152extern void _caca_sleep(unsigned int);
    151 extern unsigned int _caca_getticks(struct caca_timer *);
     153extern unsigned int _caca_getticks(caca_timer_t *);
    152154
    153155/* Internal event functions */
    154156extern void _caca_handle_resize(caca_t *);
    155157#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
    156 extern void _push_event(caca_t *, struct caca_event *);
    157 extern int _pop_event(caca_t *, struct caca_event *);
     158extern void _push_event(caca_t *, caca_event_t *);
     159extern int _pop_event(caca_t *, caca_event_t *);
    158160#endif
    159161
  • libcaca/trunk/caca/driver_conio.c

    r769 r777  
    120120}
    121121
    122 static int conio_get_event(caca_t *kk, struct caca_event *ev)
     122static int conio_get_event(caca_t *kk, caca_event_t *ev)
    123123{
    124124    unsigned char ch;
    125     struct caca_event release;
     125    caca_event_t release;
    126126
    127127    if(!_conio_kbhit())
  • libcaca/trunk/caca/driver_gl.c

    r769 r777  
    324324}
    325325
    326 static int gl_get_event(caca_t *kk, struct caca_event *ev)
     326static int gl_get_event(caca_t *kk, caca_event_t *ev)
    327327{
    328328#ifdef HAVE_GLUTCHECKLOOP
  • libcaca/trunk/caca/driver_ncurses.c

    r769 r777  
    225225}
    226226
    227 static int ncurses_get_event(caca_t *kk, struct caca_event *ev)
     227static int ncurses_get_event(caca_t *kk, caca_event_t *ev)
    228228{
    229229    int intkey;
  • libcaca/trunk/caca/driver_raw.c

    r769 r777  
    8585}
    8686
    87 static int raw_get_event(caca_t *kk, struct caca_event *ev)
     87static int raw_get_event(caca_t *kk, caca_event_t *ev)
    8888{
    8989    ev->type = CACA_EVENT_NONE;
  • libcaca/trunk/caca/driver_slang.c

    r769 r777  
    253253}
    254254
    255 static int slang_get_event(caca_t *kk, struct caca_event *ev)
     255static int slang_get_event(caca_t *kk, caca_event_t *ev)
    256256{
    257257    int intkey;
  • libcaca/trunk/caca/driver_vga.c

    r769 r777  
    133133}
    134134
    135 static int vga_get_event(caca_t *kk, struct caca_event *ev)
     135static int vga_get_event(caca_t *kk, caca_event-t *ev)
    136136{
    137137    /* FIXME */
  • libcaca/trunk/caca/driver_win32.c

    r769 r777  
    234234}
    235235
    236 static int win32_get_event(caca_t *kk, struct caca_event *ev)
     236static int win32_get_event(caca_t *kk, caca_event_t *ev)
    237237{
    238238    INPUT_RECORD rec;
  • libcaca/trunk/caca/driver_x11.c

    r769 r777  
    405405}
    406406
    407 static int x11_get_event(caca_t *kk, struct caca_event *ev)
     407static int x11_get_event(caca_t *kk, caca_event_t *ev)
    408408{
    409409    XEvent xevent;
  • libcaca/trunk/caca/event.c

    r773 r777  
    2727#include "caca_internals.h"
    2828
    29 static int _get_next_event(caca_t *, struct caca_event *);
    30 static int _lowlevel_event(caca_t *, struct caca_event *);
     29static int _get_next_event(caca_t *, caca_event_t *);
     30static int _lowlevel_event(caca_t *, caca_event_t *);
    3131
    3232#if !defined(_DOXYGEN_SKIP_ME)
     
    5858 */
    5959int caca_get_event(caca_t *kk, unsigned int event_mask,
    60                    struct caca_event *ev, int timeout)
    61 {
    62     struct caca_timer timer;
     60                   caca_event_t *ev, int timeout)
     61{
     62    caca_timer_t timer;
    6363    int usec = 0;
    6464
     
    142142 */
    143143
    144 static int _get_next_event(caca_t *kk, struct caca_event *ev)
     144static int _get_next_event(caca_t *kk, caca_event_t *ev)
    145145{
    146146#if defined(USE_SLANG) || defined(USE_NCURSES)
     
    224224}
    225225
    226 static int _lowlevel_event(caca_t *kk, struct caca_event *ev)
     226static int _lowlevel_event(caca_t *kk, caca_event_t *ev)
    227227{
    228228#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO)
     
    237237
    238238#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
    239 void _push_event(caca_t *kk, struct caca_event *ev)
     239void _push_event(caca_t *kk, caca_event_t *ev)
    240240{
    241241    if(!ev->type || kk->events.queue == EVENTBUF_LEN)
     
    245245}
    246246
    247 int _pop_event(caca_t *kk, struct caca_event *ev)
     247int _pop_event(caca_t *kk, caca_event_t *ev)
    248248{
    249249    int i;
  • libcaca/trunk/caca/time.c

    r769 r777  
    4646}
    4747
    48 unsigned int _caca_getticks(struct caca_timer *timer)
     48unsigned int _caca_getticks(caca_timer_t *timer)
    4949{
    5050#if defined(HAVE_GETTIMEOFDAY)
Note: See TracChangeset for help on using the changeset viewer.