Changeset 796 for libcaca/trunk/cpp


Ignore:
Timestamp:
Apr 17, 2006, 3:23:28 PM (14 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Fixed compile problem, put Event outside Caca class
Location:
libcaca/trunk/cpp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/cpp/caca++.cpp

    r784 r796  
    6868    return caca_set_window_title(kk, s);
    6969}
    70 int     Caca::get_event (unsigned int g, Caca::Event *n, int aa)
     70int     Caca::get_event (unsigned int g, Event *n, int aa)
    7171{
    7272    return caca_get_event(kk, g, n->e, aa);
  • libcaca/trunk/cpp/caca++.h

    r784 r796  
    3030
    3131
     32class Event {
     33    friend class Caca;
     34 public:
     35    enum caca_event_type
     36    {
     37        CACA_EVENT_NONE =          0x0000, /**< No event. */
     38
     39        CACA_EVENT_KEY_PRESS =     0x0001, /**< A key was pressed. */
     40        CACA_EVENT_KEY_RELEASE =   0x0002, /**< A key was released. */
     41        CACA_EVENT_MOUSE_PRESS =   0x0004, /**< A mouse button was pressed. */
     42        CACA_EVENT_MOUSE_RELEASE = 0x0008, /**< A mouse button was released. */
     43        CACA_EVENT_MOUSE_MOTION =  0x0010, /**< The mouse was moved. */
     44        CACA_EVENT_RESIZE =        0x0020, /**< The window was resized. */
     45
     46        CACA_EVENT_ANY =           0xffff  /**< Bitmask for any event. */
     47    } type;
     48
     49 protected:
     50    caca_event *e;
     51};
     52
    3253class Caca {
    3354 public:
     
    3556    Caca(Cucul *qq);
    3657    ~Caca();
    37 
    38     class Event {
    39         friend class Caca;
    40     protected:
    41         caca_event *e;
    42     };
    43 
    4458
    4559    void    attach (Cucul *qq);
     
    5165    unsigned int        get_window_height ();
    5266    int         set_window_title (char const *);
    53     int         get_event (unsigned int, Caca::Event*, int);
     67    int         get_event (unsigned int, Event*, int);
    5468    unsigned int        get_mouse_x ();
    5569    unsigned int        get_mouse_y ();
     
    6074    private:
    6175    caca_t *kk;
    62 
    63 
    6476};
    6577
  • libcaca/trunk/cpp/cpptest.cpp

    r785 r796  
    4444    Cucul *qq;
    4545    Caca  *kk;
    46     Caca::Event ev;
     46    Event ev;
     47
    4748    int x = 0, y = 0, ix = 1, iy = 1;
    4849
     
    6768    kk->set_delay(20000);
    6869
    69     while(!kk->get_event(CACA_EVENT_KEY_PRESS, &ev, 0)) {
     70    while(!kk->get_event(ev.CACA_EVENT_KEY_PRESS, &ev, 0)) {
    7071       
    7172        /* Draw pig */
Note: See TracChangeset for help on using the changeset viewer.