include/SDL_mouse.h
changeset 4465 3e69e077cb95
parent 3697 f7b03b6838cb
child 5262 b530ef003506
     1.1 --- a/include/SDL_mouse.h	Sun May 09 19:55:28 2010 -0700
     1.2 +++ b/include/SDL_mouse.h	Sun May 09 20:47:22 2010 -0700
     1.3 @@ -24,6 +24,22 @@
     1.4   *  \file SDL_mouse.h
     1.5   *  
     1.6   *  Include file for SDL mouse event handling.
     1.7 + *
     1.8 + *  Please note that this ONLY discusses "mice" with the notion of the
     1.9 + *  desktop GUI. You (usually) have one system cursor, and the OS hides
    1.10 + *  the hardware details from you. If you plug in 10 mice, all ten move that
    1.11 + *  one cursor. For many applications and games, this is perfect, and this
    1.12 + *  API has served hundreds of SDL programs well since its birth.
    1.13 + *
    1.14 + *  It's not the whole picture, though. If you want more lowlevel control,
    1.15 + *  SDL offers a different API, that gives you visibility into each input
    1.16 + *  device, multi-touch interfaces, etc.
    1.17 + *
    1.18 + *  Those two APIs are incompatible, and you usually should not use both
    1.19 + *  at the same time. But for legacy purposes, this API refers to a "mouse"
    1.20 + *  when it actually means the system pointer and not a physical mouse.
    1.21 + *
    1.22 + *  The other API is in SDL_input.h
    1.23   */
    1.24  
    1.25  #ifndef _SDL_mouse_h
    1.26 @@ -43,45 +59,50 @@
    1.27  
    1.28  typedef struct SDL_Cursor SDL_Cursor;   /* Implementation dependent */
    1.29  
    1.30 +
    1.31  /* Function prototypes */
    1.32  
    1.33  /**
    1.34 - *  \brief Get the number of mouse input devices available.
    1.35 - *  
    1.36 - *  \sa SDL_SelectMouse()
    1.37 + *  \brief Get the window which currently has mouse focus.
    1.38   */
    1.39 -extern DECLSPEC int SDLCALL SDL_GetNumMice(void);
    1.40 +extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
    1.41  
    1.42  /**
    1.43 - *  \brief Gets the name of a mouse with the given index.
    1.44 + *  \brief Retrieve the current state of the mouse.
    1.45   *  
    1.46 - *  \param index is the index of the mouse, which name is to be returned.
    1.47 - *  
    1.48 - *  \return the name of the mouse with the specified index
    1.49 + *  The current button state is returned as a button bitmask, which can
    1.50 + *  be tested using the SDL_BUTTON(X) macros, and x and y are set to the
    1.51 + *  mouse cursor position relative to the focus window for the currently
    1.52 + *  selected mouse.  You can pass NULL for either x or y.
    1.53   */
    1.54 -extern DECLSPEC char *SDLCALL SDL_GetMouseName(int index);
    1.55 +extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
    1.56  
    1.57  /**
    1.58 - *  \brief Set the index of the currently selected mouse.
    1.59 - *  
    1.60 - *  \return The index of the previously selected mouse.
    1.61 - *  
    1.62 - *  \note You can query the currently selected mouse by passing an index of -1.
    1.63 - *  
    1.64 - *  \sa SDL_GetNumMice()
    1.65 + *  \brief Retrieve the relative state of the mouse.
    1.66 + *
    1.67 + *  The current button state is returned as a button bitmask, which can
    1.68 + *  be tested using the SDL_BUTTON(X) macros, and x and y are set to the
    1.69 + *  mouse deltas since the last call to SDL_GetRelativeMouseState().
    1.70   */
    1.71 -extern DECLSPEC int SDLCALL SDL_SelectMouse(int index);
    1.72 +extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
    1.73  
    1.74  /**
    1.75 - *  \brief Get the window which currently has focus for the specified mouse.
    1.76 + *  \brief Moves the mouse to the given position within the window.
    1.77 + *  
    1.78 + *  \param window The window to move the mouse into, or NULL for the current mouse focus
    1.79 + *  \param x The x coordinate within the window
    1.80 + *  \param y The y coordinate within the window
    1.81 + *  
    1.82 + *  \note This function generates a mouse motion event
    1.83   */
    1.84 -extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocusWindow(int index);
    1.85 +extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
    1.86 +                                                   int x, int y);
    1.87  
    1.88  /**
    1.89 - *  \brief Set relative mouse mode for the specified mouse.
    1.90 + *  \brief Set relative mouse mode.
    1.91   *  
    1.92   *  \param enabled Whether or not to enable relative mode
    1.93 - *  
    1.94 + *
    1.95   *  \return 0 on success, or -1 if relative mode is not supported.
    1.96   *  
    1.97   *  While the mouse is in relative mode, the cursor is hidden, and the
    1.98 @@ -93,51 +114,18 @@
    1.99   *  
   1.100   *  \sa SDL_GetRelativeMouseMode()
   1.101   */
   1.102 -extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(int index,
   1.103 -                                                     SDL_bool enabled);
   1.104 +extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
   1.105  
   1.106  /**
   1.107 - *  \brief Query whether relative mouse mode is enabled for the specified mouse.
   1.108 + *  \brief Query whether relative mouse mode is enabled.
   1.109   *  
   1.110   *  \sa SDL_SetRelativeMouseMode()
   1.111   */
   1.112 -extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(int index);
   1.113 +extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
   1.114  
   1.115  /**
   1.116 - *  \brief Retrieve the current state of the specified mouse.
   1.117 - *  
   1.118 - *  The current button state is returned as a button bitmask, which can
   1.119 - *  be tested using the SDL_BUTTON(X) macros, and x and y are set to the
   1.120 - *  mouse cursor position relative to the focus window for the currently
   1.121 - *  selected mouse.  You can pass NULL for either x or y.
   1.122 - */
   1.123 -extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
   1.124 -
   1.125 -/**
   1.126 - *  \brief Retrieve the state of the specified mouse.
   1.127 - *
   1.128 - *  The current button state is returned as a button bitmask, which can
   1.129 - *  be tested using the SDL_BUTTON(X) macros, and x and y are set to the
   1.130 - *  mouse deltas since the last call to SDL_GetRelativeMouseState().
   1.131 - */
   1.132 -extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int index, int *x,
   1.133 -                                                        int *y);
   1.134 -
   1.135 -/**
   1.136 - *  \brief Moves the currently selected mouse to the given position within the window.
   1.137 - *  
   1.138 - *  \param window The window to move the mouse into, or NULL for the current mouse focus
   1.139 - *  \param x The x coordinate within the window
   1.140 - *  \param y The y coordinate within the window
   1.141 - *  
   1.142 - *  \note This function generates a mouse motion event
   1.143 - */
   1.144 -extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
   1.145 -                                                   int x, int y);
   1.146 -
   1.147 -/**
   1.148 - *  \brief Create a cursor for the currently selected mouse, using the
   1.149 - *         specified bitmap data and mask (in MSB format).
   1.150 + *  \brief Create a cursor, using the specified bitmap data and
   1.151 + *         mask (in MSB format).
   1.152   *  
   1.153   *  The cursor width must be a multiple of 8 bits.
   1.154   *  
   1.155 @@ -148,7 +136,7 @@
   1.156   *  <tr><td>  1   </td><td>  1   </td><td> Black </td></tr>
   1.157   *  <tr><td>  0   </td><td>  0   </td><td> Transparent </td></tr>
   1.158   *  <tr><td>  1   </td><td>  0   </td><td> Inverted color if possible, black 
   1.159 -                                           if not. </td></tr>
   1.160 + *                                         if not. </td></tr>
   1.161   *  </table>
   1.162   *  
   1.163   *  \sa SDL_FreeCursor()
   1.164 @@ -159,14 +147,12 @@
   1.165                                                       int hot_y);
   1.166  
   1.167  /**
   1.168 - *  \brief Set the active cursor for the currently selected mouse.
   1.169 - *  
   1.170 - *  \note The cursor must have been created for the selected mouse.
   1.171 + *  \brief Set the active cursor.
   1.172   */
   1.173  extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
   1.174  
   1.175  /**
   1.176 - *  \brief Return the active cursor for the currently selected mouse.
   1.177 + *  \brief Return the active cursor.
   1.178   */
   1.179  extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
   1.180  
   1.181 @@ -178,8 +164,7 @@
   1.182  extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
   1.183  
   1.184  /**
   1.185 - *  \brief Toggle whether or not the cursor is shown for the currently selected 
   1.186 - *         mouse.
   1.187 + *  \brief Toggle whether or not the cursor is shown.
   1.188   *  
   1.189   *  \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current 
   1.190   *                state.
   1.191 @@ -189,38 +174,6 @@
   1.192  extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
   1.193  
   1.194  /**
   1.195 - *  \brief Gets the number of cursors a pointing device supports.
   1.196 - *  
   1.197 - *  Useful for tablet users. Useful only under Windows.
   1.198 - *  
   1.199 - *  \param index is the index of the pointing device, which number of cursors we
   1.200 - *               want to receive.
   1.201 - *  
   1.202 - *  \return the number of cursors supported by the pointing device. On Windows
   1.203 - *          if a device is a tablet it returns a number >=1. Normal mice always 
   1.204 - *          return 1.
   1.205 - *  
   1.206 - *  On Linux every device reports one cursor.
   1.207 - */
   1.208 -extern DECLSPEC int SDLCALL SDL_GetCursorsNumber(int index);
   1.209 -
   1.210 -/**
   1.211 - *  \brief Returns the index of the current cursor used by a specific pointing
   1.212 - *         device.
   1.213 - *  
   1.214 - *  Useful only under Windows.
   1.215 - *  
   1.216 - *  \param index is the index of the pointing device, which cursor index we want
   1.217 - *               to receive.
   1.218 - *  
   1.219 - *  \return the index of the cursor currently used by a specific pointing 
   1.220 - *          device.  Always 0 under Linux. On Windows if the device isn't a 
   1.221 - *          tablet it returns 0.  If the device is the tablet it returns the 
   1.222 - *          cursor index.  0 - stylus, 1 - eraser, 2 - cursor.
   1.223 - */
   1.224 -extern DECLSPEC int SDLCALL SDL_GetCurrentCursor(int index);
   1.225 -
   1.226 -/**
   1.227   *  Used as a mask when testing buttons in buttonstate.
   1.228   *   - Button 1:  Left mouse button
   1.229   *   - Button 2:  Middle mouse button