include/SDL_mouse.h
author Jørgen P. Tjernø <jorgen@valvesoftware.com>
Wed, 24 Apr 2013 10:42:44 -0700
changeset 7104 4e4ca313000c
parent 7067 7ac321f6e0e4
child 7191 75360622e65f
permissions -rw-r--r--
Add SDL_GetDefaultCursor. This fixes http://bugzilla.libsdl.org/show_bug.cgi?id=1798 Thanks to Alex Szpakowski for suggestion & patch.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     1
/*
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5473
diff changeset
     2
  Simple DirectMedia Layer
6885
700f1b25f77f Happy New Year!
Sam Lantinga <slouken@libsdl.org>
parents: 6677
diff changeset
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     4
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5473
diff changeset
     5
  This software is provided 'as-is', without any express or implied
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5473
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5473
diff changeset
     7
  arising from the use of this software.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     8
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5473
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5473
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5473
diff changeset
    11
  freely, subject to the following restrictions:
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    12
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5473
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5473
diff changeset
    14
     claim that you wrote the original software. If you use this software
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5473
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5473
diff changeset
    16
     appreciated but is not required.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5473
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5473
diff changeset
    18
     misrepresented as being the original software.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5473
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    20
*/
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    21
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
    22
/**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    23
 *  \file SDL_mouse.h
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    24
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    25
 *  Include file for SDL mouse event handling.
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
    26
 */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    27
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    28
#ifndef _SDL_mouse_h
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    29
#define _SDL_mouse_h
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    30
1356
67114343400d *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 1330
diff changeset
    31
#include "SDL_stdinc.h"
1358
c71e05b4dc2e More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents: 1356
diff changeset
    32
#include "SDL_error.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    33
#include "SDL_video.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    34
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    35
#include "begin_code.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    36
/* Set up for C function definitions, even when using C++ */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    37
#ifdef __cplusplus
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
    38
/* *INDENT-OFF* */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    39
extern "C" {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
    40
/* *INDENT-ON* */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    41
#endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    42
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
    43
typedef struct SDL_Cursor SDL_Cursor;   /* Implementation dependent */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    44
6675
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    45
/**
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    46
 * \brief Cursor types for SDL_CreateSystemCursor.
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    47
 */
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    48
typedef enum
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    49
{
7067
7ac321f6e0e4 Removed C++-style single-line comments from a public header (thanks, Martin!).
Ryan C. Gordon <icculus@icculus.org>
parents: 6901
diff changeset
    50
    SDL_SYSTEM_CURSOR_ARROW,     /**< Arrow */
7ac321f6e0e4 Removed C++-style single-line comments from a public header (thanks, Martin!).
Ryan C. Gordon <icculus@icculus.org>
parents: 6901
diff changeset
    51
    SDL_SYSTEM_CURSOR_IBEAM,     /**< I-beam */
7ac321f6e0e4 Removed C++-style single-line comments from a public header (thanks, Martin!).
Ryan C. Gordon <icculus@icculus.org>
parents: 6901
diff changeset
    52
    SDL_SYSTEM_CURSOR_WAIT,      /**< Wait */
7ac321f6e0e4 Removed C++-style single-line comments from a public header (thanks, Martin!).
Ryan C. Gordon <icculus@icculus.org>
parents: 6901
diff changeset
    53
    SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */
7ac321f6e0e4 Removed C++-style single-line comments from a public header (thanks, Martin!).
Ryan C. Gordon <icculus@icculus.org>
parents: 6901
diff changeset
    54
    SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */
7ac321f6e0e4 Removed C++-style single-line comments from a public header (thanks, Martin!).
Ryan C. Gordon <icculus@icculus.org>
parents: 6901
diff changeset
    55
    SDL_SYSTEM_CURSOR_SIZENWSE,  /**< Double arrow pointing northwest and southeast */
7ac321f6e0e4 Removed C++-style single-line comments from a public header (thanks, Martin!).
Ryan C. Gordon <icculus@icculus.org>
parents: 6901
diff changeset
    56
    SDL_SYSTEM_CURSOR_SIZENESW,  /**< Double arrow pointing northeast and southwest */
7ac321f6e0e4 Removed C++-style single-line comments from a public header (thanks, Martin!).
Ryan C. Gordon <icculus@icculus.org>
parents: 6901
diff changeset
    57
    SDL_SYSTEM_CURSOR_SIZEWE,    /**< Double arrow pointing west and east */
7ac321f6e0e4 Removed C++-style single-line comments from a public header (thanks, Martin!).
Ryan C. Gordon <icculus@icculus.org>
parents: 6901
diff changeset
    58
    SDL_SYSTEM_CURSOR_SIZENS,    /**< Double arrow pointing north and south */
7ac321f6e0e4 Removed C++-style single-line comments from a public header (thanks, Martin!).
Ryan C. Gordon <icculus@icculus.org>
parents: 6901
diff changeset
    59
    SDL_SYSTEM_CURSOR_SIZEALL,   /**< Four pointed arrow pointing north, south, east, and west */
7ac321f6e0e4 Removed C++-style single-line comments from a public header (thanks, Martin!).
Ryan C. Gordon <icculus@icculus.org>
parents: 6901
diff changeset
    60
    SDL_SYSTEM_CURSOR_NO,        /**< Slashed circle or crossbones */
7ac321f6e0e4 Removed C++-style single-line comments from a public header (thanks, Martin!).
Ryan C. Gordon <icculus@icculus.org>
parents: 6901
diff changeset
    61
    SDL_SYSTEM_CURSOR_HAND,      /**< Hand */
6677
c3202c29e352 Added code to testwm2 to test the system cursor support
Sam Lantinga <slouken@libsdl.org>
parents: 6675
diff changeset
    62
    SDL_NUM_SYSTEM_CURSORS
6675
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    63
} SDL_SystemCursor;
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    64
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    65
/* Function prototypes */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
    66
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
    67
/**
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    68
 *  \brief Get the window which currently has mouse focus.
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
    69
 */
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    70
extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
    71
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
    72
/**
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    73
 *  \brief Retrieve the current state of the mouse.
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    74
 *  
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    75
 *  The current button state is returned as a button bitmask, which can
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    76
 *  be tested using the SDL_BUTTON(X) macros, and x and y are set to the
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    77
 *  mouse cursor position relative to the focus window for the currently
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    78
 *  selected mouse.  You can pass NULL for either x or y.
2718
abacf2555bb4 Removed unneccesary code lines. Fixed mousename bug. Added lacking code in mousebutton
Szymon Wilczek <kazeuser@gmail.com>
parents: 2710
diff changeset
    79
 */
6673
78f18a929123 Nobody will EVER use more than 8 buttons. Oh wait... Nobody will EVER use more than 32 buttons...
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    80
extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y);
2718
abacf2555bb4 Removed unneccesary code lines. Fixed mousename bug. Added lacking code in mousebutton
Szymon Wilczek <kazeuser@gmail.com>
parents: 2710
diff changeset
    81
abacf2555bb4 Removed unneccesary code lines. Fixed mousename bug. Added lacking code in mousebutton
Szymon Wilczek <kazeuser@gmail.com>
parents: 2710
diff changeset
    82
/**
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    83
 *  \brief Retrieve the relative state of the mouse.
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    84
 *
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    85
 *  The current button state is returned as a button bitmask, which can
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    86
 *  be tested using the SDL_BUTTON(X) macros, and x and y are set to the
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    87
 *  mouse deltas since the last call to SDL_GetRelativeMouseState().
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
    88
 */
6673
78f18a929123 Nobody will EVER use more than 8 buttons. Oh wait... Nobody will EVER use more than 32 buttons...
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    89
extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
    90
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
    91
/**
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    92
 *  \brief Moves the mouse to the given position within the window.
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    93
 *  
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    94
 *  \param window The window to move the mouse into, or NULL for the current mouse focus
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    95
 *  \param x The x coordinate within the window
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    96
 *  \param y The y coordinate within the window
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    97
 *  
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
    98
 *  \note This function generates a mouse motion event
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
    99
 */
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   100
extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   101
                                                   int x, int y);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   102
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   103
/**
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   104
 *  \brief Set relative mouse mode.
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   105
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   106
 *  \param enabled Whether or not to enable relative mode
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   107
 *
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   108
 *  \return 0 on success, or -1 if relative mode is not supported.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   109
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   110
 *  While the mouse is in relative mode, the cursor is hidden, and the
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   111
 *  driver will try to report continuous motion in the current window.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   112
 *  Only relative motion events will be delivered, the mouse position
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   113
 *  will not change.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   114
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   115
 *  \note This function will flush any pending mouse motion.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   116
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   117
 *  \sa SDL_GetRelativeMouseMode()
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   118
 */
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   119
extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   120
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   121
/**
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   122
 *  \brief Query whether relative mouse mode is enabled.
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   123
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   124
 *  \sa SDL_SetRelativeMouseMode()
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   125
 */
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   126
extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   127
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   128
/**
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   129
 *  \brief Create a cursor, using the specified bitmap data and
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   130
 *         mask (in MSB format).
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   131
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   132
 *  The cursor width must be a multiple of 8 bits.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   133
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   134
 *  The cursor is created in black and white according to the following:
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   135
 *  <table>
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   136
 *  <tr><td> data </td><td> mask </td><td> resulting pixel on screen </td></tr>
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   137
 *  <tr><td>  0   </td><td>  1   </td><td> White </td></tr>
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   138
 *  <tr><td>  1   </td><td>  1   </td><td> Black </td></tr>
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   139
 *  <tr><td>  0   </td><td>  0   </td><td> Transparent </td></tr>
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   140
 *  <tr><td>  1   </td><td>  0   </td><td> Inverted color if possible, black 
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   141
 *                                         if not. </td></tr>
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   142
 *  </table>
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   143
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   144
 *  \sa SDL_FreeCursor()
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   145
 */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   146
extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   147
                                                     const Uint8 * mask,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   148
                                                     int w, int h, int hot_x,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   149
                                                     int hot_y);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   150
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   151
/**
5473
5665ccbd6792 Added a function to create color cursors: SDL_CreateColorCursor()
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   152
 *  \brief Create a color cursor.
5665ccbd6792 Added a function to create color cursors: SDL_CreateColorCursor()
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   153
 *  
5665ccbd6792 Added a function to create color cursors: SDL_CreateColorCursor()
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   154
 *  \sa SDL_FreeCursor()
5665ccbd6792 Added a function to create color cursors: SDL_CreateColorCursor()
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   155
 */
5665ccbd6792 Added a function to create color cursors: SDL_CreateColorCursor()
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   156
extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
5665ccbd6792 Added a function to create color cursors: SDL_CreateColorCursor()
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   157
                                                          int hot_x,
5665ccbd6792 Added a function to create color cursors: SDL_CreateColorCursor()
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   158
                                                          int hot_y);
5665ccbd6792 Added a function to create color cursors: SDL_CreateColorCursor()
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   159
5665ccbd6792 Added a function to create color cursors: SDL_CreateColorCursor()
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   160
/**
6675
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
   161
 *  \brief Create a system cursor.
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
   162
 *
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
   163
 *  \sa SDL_FreeCursor()
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
   164
 */
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
   165
extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
   166
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
   167
/**
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   168
 *  \brief Set the active cursor.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   169
 */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   170
extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   171
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   172
/**
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   173
 *  \brief Return the active cursor.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   174
 */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   175
extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   176
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   177
/**
7104
4e4ca313000c Add SDL_GetDefaultCursor.
Jørgen P. Tjernø <jorgen@valvesoftware.com>
parents: 7067
diff changeset
   178
 *  \brief Return the default cursor.
4e4ca313000c Add SDL_GetDefaultCursor.
Jørgen P. Tjernø <jorgen@valvesoftware.com>
parents: 7067
diff changeset
   179
 */
4e4ca313000c Add SDL_GetDefaultCursor.
Jørgen P. Tjernø <jorgen@valvesoftware.com>
parents: 7067
diff changeset
   180
extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
4e4ca313000c Add SDL_GetDefaultCursor.
Jørgen P. Tjernø <jorgen@valvesoftware.com>
parents: 7067
diff changeset
   181
4e4ca313000c Add SDL_GetDefaultCursor.
Jørgen P. Tjernø <jorgen@valvesoftware.com>
parents: 7067
diff changeset
   182
/**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   183
 *  \brief Frees a cursor created with SDL_CreateCursor().
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   184
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   185
 *  \sa SDL_CreateCursor()
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   186
 */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   187
extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   188
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   189
/**
4465
3e69e077cb95 Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API.
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
   190
 *  \brief Toggle whether or not the cursor is shown.
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   191
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   192
 *  \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current 
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   193
 *                state.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   194
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   195
 *  \return 1 if the cursor is shown, or 0 if the cursor is hidden.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   196
 */
337
9154ec9ca3d2 Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
   197
extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   198
2718
abacf2555bb4 Removed unneccesary code lines. Fixed mousename bug. Added lacking code in mousebutton
Szymon Wilczek <kazeuser@gmail.com>
parents: 2710
diff changeset
   199
/**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   200
 *  Used as a mask when testing buttons in buttonstate.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   201
 *   - Button 1:  Left mouse button
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   202
 *   - Button 2:  Middle mouse button
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   203
 *   - Button 3:  Right mouse button
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   204
 */
1330
450721ad5436 It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
   205
#define SDL_BUTTON(X)		(1 << ((X)-1))
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   206
#define SDL_BUTTON_LEFT		1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   207
#define SDL_BUTTON_MIDDLE	2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   208
#define SDL_BUTTON_RIGHT	3
2284
545fbf461c5b Fixed bug #464
Sam Lantinga <slouken@libsdl.org>
parents: 2242
diff changeset
   209
#define SDL_BUTTON_X1		4
545fbf461c5b Fixed bug #464
Sam Lantinga <slouken@libsdl.org>
parents: 2242
diff changeset
   210
#define SDL_BUTTON_X2		5
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   211
#define SDL_BUTTON_LMASK	SDL_BUTTON(SDL_BUTTON_LEFT)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   212
#define SDL_BUTTON_MMASK	SDL_BUTTON(SDL_BUTTON_MIDDLE)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   213
#define SDL_BUTTON_RMASK	SDL_BUTTON(SDL_BUTTON_RIGHT)
2284
545fbf461c5b Fixed bug #464
Sam Lantinga <slouken@libsdl.org>
parents: 2242
diff changeset
   214
#define SDL_BUTTON_X1MASK	SDL_BUTTON(SDL_BUTTON_X1)
545fbf461c5b Fixed bug #464
Sam Lantinga <slouken@libsdl.org>
parents: 2242
diff changeset
   215
#define SDL_BUTTON_X2MASK	SDL_BUTTON(SDL_BUTTON_X2)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   216
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   217
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   218
/* Ends C function definitions when using C++ */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   219
#ifdef __cplusplus
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   220
/* *INDENT-OFF* */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   221
}
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   222
/* *INDENT-ON* */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   223
#endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   224
#include "close_code.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   225
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   226
#endif /* _SDL_mouse_h */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   227
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
   228
/* vi: set ts=4 sw=4 expandtab: */