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/sdlport/event.cpp

    r647 r652  
    3030#include "palette.h"
    3131#include "video.h"
    32 #include "mouse.h"
    3332#include "event.h"
    3433#include "timing.h"
     
    4039short mouse_buttons[5] = { 0, 0, 0, 0, 0 };
    4140
    42 //
    43 // Constructor
    44 //
    45 EventHandler::EventHandler(image *screen, palette *pal)
    46 {
    47     CHECK(screen && pal);
    48     mouse = new JCMouse(screen, pal);
    49     mhere = mouse->exists();
    50     last_keystat = get_key_flags();
    51     m_pending = 0;
    52 
     41void EventHandler::SysInit()
     42{
    5343    // Ignore activate events
    5444    SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE);
     45}
     46
     47void EventHandler::SysWarpMouse(vec2i pos)
     48{
     49    SDL_WarpMouse(pos.x, pos.y);
    5550}
    5651
     
    112107    // NOTE : that the mouse status should be known
    113108    // even if another event has occurred.
    114     ev.mouse_move.x = mouse->x();
    115     ev.mouse_move.y = mouse->y();
    116     ev.mouse_button = mouse->button();
     109    ev.mouse_move.x = m_pos.x;
     110    ev.mouse_move.y = m_pos.y;
     111    ev.mouse_button = m_button;
    117112
    118113    // Gather next event
     
    173168        ev.mouse_button &= (0xff - RIGHT_BUTTON);
    174169    }
    175     mouse->update(ev.mouse_move.x, ev.mouse_move.y, ev.mouse_button);
     170    m_pos = vec2i(ev.mouse_move.x, ev.mouse_move.y);
     171    m_button = ev.mouse_button;
    176172
    177173    // Sort out other kinds of events
Note: See TracChangeset for help on using the changeset viewer.