Ignore:
Timestamp:
May 14, 2011, 4:00:48 PM (11 years ago)
Author:
Sam Hocevar
Message:

imlib: merge JCMouse into EventHandler?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/imlib/event.h

    r645 r652  
    2828#include "keys.h"
    2929#include "sprite.h"
    30 #include "mouse.h"
    3130
    3231class Jwindow;
     
    7069    }
    7170
    72   JCMouse *mouse;
    73   sprite *mouse_sprite() { return mouse->mouse_sprite(); }
     71    void SysInit();
     72    void SysWarpMouse(vec2i pos);
     73
    7474  int IsPending();
    7575  void Get(Event &ev);
    7676  void add_redraw(int X1, int Y1, int X2, int Y2, void *Start);
    77   void mouse_status(int &x, int &y, int &button)
     77  void flush_screen();
     78
     79  int has_mouse() { return 1; }
     80  void set_mouse_shape(image *im, int centerx, int centery)
    7881  {
    79     if (mouse)
    80     {
    81       x = mouse->x();
    82       y = mouse->y();
    83       button = mouse->button();
    84     } else x = y = button = 0;
     82    m_sprite->change_visual(im);
     83    m_center = vec2i(-centerx, -centery);
    8584  }
    86   void flush_screen();
    87   int has_mouse() { return mouse->exists(); }
    88   void set_mouse_shape(image *im, int centerx, int centery) { mouse->set_shape(im, -centerx, -centery); }
    89   void set_mouse_position(int mx, int my) { if (mouse) mouse->set_position(mx, my); }
     85  void set_mouse_position(int mx, int my)
     86  {
     87    m_pos = vec2i(Min(mx, m_screen->Size().x - 1),
     88                  Min(my, m_screen->Size().y - 1));
     89    SysWarpMouse(m_pos);
     90  }
    9091
    9192private:
     
    9394
    9495    linked_list m_events;
    95     int mhere, m_pending, last_keystat, last_key;
     96    int m_pending, last_keystat, last_key;
    9697    sprite_controller sc;
     98
     99    image *m_screen;
     100
     101protected:
     102    /* Mouse information */
     103    sprite *m_sprite;
     104    vec2i m_pos, m_lastpos, m_center;
     105    int m_button, m_lastbutton;
    97106};
    98107
Note: See TracChangeset for help on using the changeset viewer.