Changeset 304 for trunk/src/gl


Ignore:
Timestamp:
08/11/14 11:56:19 (11 years ago)
Author:
epyon
Message:
  • mouse wheel support for both SDL 1.2 and 2.0
  • optional unmerged MD3 import
  • selective delete mesh form mesh_creator
  • minor fixes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gl/gl_window.cc

    r295 r304  
    115115        case SDL_BUTTON_MIDDLE    : mevent.mbutton.button = MOUSE_MIDDLE; break;
    116116        case SDL_BUTTON_RIGHT     : mevent.mbutton.button = MOUSE_RIGHT; break;
    117         //case SDL_BUTTON_WHEELUP   : mevent.mbutton.button = MOUSE_WHEEL_UP; break;
    118         //case SDL_BUTTON_WHEELDOWN : mevent.mbutton.button = MOUSE_WHEEL_DOWN; break;
     117#if NV_SDL_VERSION == NV_SDL_12
     118        case SDL_BUTTON_WHEELUP   :
     119                mevent.type           = EV_MOUSE_WHEEL;
     120                mevent.mwheel.x       = 0;
     121                mevent.mwheel.y       = 3;
     122                return true;
     123        case SDL_BUTTON_WHEELDOWN :
     124                mevent.type           = EV_MOUSE_WHEEL;
     125                mevent.mwheel.x       = 0;
     126                mevent.mwheel.y       = -3;
     127                return true;
     128#endif
    119129        default : break;
    120130        }
     
    122132        return mevent.mbutton.button != MOUSE_NONE;
    123133}
     134
     135#if NV_SDL_VERSION == NV_SDL_20
     136static bool sdl_mouse_wheel_to_io_event( const SDL_MouseWheelEvent& mm, io_event& mevent )
     137{
     138        mevent.type          = EV_MOUSE_WHEEL;
     139        mevent.mwheel.x      = static_cast< sint32 >( mm.x );
     140        mevent.mwheel.y      = static_cast< sint32 >( mm.y );
     141        return true;
     142}
     143#endif
    124144
    125145static bool sdl_mouse_motion_to_io_event( const SDL_MouseMotionEvent& mm, io_event& mevent )
     
    180200        case SDL_MOUSEBUTTONDOWN : return sdl_mouse_button_to_io_event( e.button, ioevent );
    181201        case SDL_MOUSEBUTTONUP   : return sdl_mouse_button_to_io_event( e.button, ioevent );
     202#if NV_SDL_VERSION == NV_SDL_20
     203        case SDL_MOUSEWHEEL      : return sdl_mouse_wheel_to_io_event( e.wheel, ioevent );
     204#endif
    182205/* // SDL 2.0 incompatible
    183206        case SDL_ACTIVEEVENT     :
Note: See TracChangeset for help on using the changeset viewer.