Implemented SDL_GetMouseState().
authorRyan C. Gordon <icculus@icculus.org>
Fri, 12 Apr 2013 23:58:58 -0400
changeset 295cebb18c6f81
parent 28 7507f323a8a7
child 30 f0da34bc3c45
Implemented SDL_GetMouseState().
src/SDL12_compat.c
src/SDL20_syms.h
     1.1 --- a/src/SDL12_compat.c	Fri Apr 12 23:48:09 2013 -0400
     1.2 +++ b/src/SDL12_compat.c	Fri Apr 12 23:58:58 2013 -0400
     1.3 @@ -41,7 +41,6 @@
     1.4  // !!! IMPLEMENT_ME SDL_GetKeyName
     1.5  // !!! IMPLEMENT_ME SDL_GetKeyState
     1.6  // !!! IMPLEMENT_ME SDL_GetModState
     1.7 -// !!! IMPLEMENT_ME SDL_GetMouseState
     1.8  // !!! IMPLEMENT_ME SDL_GetRelativeMouseState
     1.9  // !!! IMPLEMENT_ME SDL_LockSurface
    1.10  // !!! IMPLEMENT_ME SDL_LowerBlit
    1.11 @@ -1940,6 +1939,21 @@
    1.12      return (SDL_GrabMode) SDL_GetWindowGrab(VideoWindow20);
    1.13  }
    1.14  
    1.15 +Uint8
    1.16 +SDL_GetMouseState(int *x, int *y)
    1.17 +{
    1.18 +    const Uint32 state20 = SDL20_GetMouseState(x, y);
    1.19 +    Uint8 retval = (state20 & 0x7);  /* left, right, and middle will match. */
    1.20 +
    1.21 +    /* the X[12] buttons are different in 1.2; mousewheel was in the way. */
    1.22 +    if (state20 & SDL_BUTTON(SDL_BUTTON_X1))
    1.23 +        retval |= (1<<5);
    1.24 +    if (state20 & SDL_BUTTON(SDL_BUTTON_X2))
    1.25 +        retval |= (1<<6);
    1.26 +
    1.27 +    return retval;
    1.28 +}
    1.29 +
    1.30  void
    1.31  SDL_WarpMouse(Uint16 x, Uint16 y)
    1.32  {
     2.1 --- a/src/SDL20_syms.h	Fri Apr 12 23:48:09 2013 -0400
     2.2 +++ b/src/SDL20_syms.h	Fri Apr 12 23:58:58 2013 -0400
     2.3 @@ -50,6 +50,8 @@
     2.4  SDL20_SYM(int,FillRect,(SDL_Surface *a,const SDL_Rect *b,Uint32 c),(a,b,c),return)
     2.5  SDL20_SYM(SDL_bool,IntersectRect,(const SDL_Rect *a,const SDL_Rect *b,SDL_Rect *c),(a,b,c),return)
     2.6  
     2.7 +SDL20_SYM(Uint32,GetMouseState,(int *a, int *b),(a,b),return)
     2.8 +
     2.9  SDL20_SYM_PASSTHROUGH(int,ShowCursor,(int a),(a),return)
    2.10  SDL20_SYM(SDL_Cursor *,CreateCursor,(const Uint8 *a,const Uint8 *b,int c,int d,int e,int f),(a,b,c,d,e,f),return)
    2.11  SDL20_SYM(void,SetCursor,(SDL_Cursor *a),(a),)