include/SDL_mouse.h
author Michael Sartain <mikesart@valvesoftware.com>
Mon, 19 Nov 2012 15:11:10 -0800
changeset 6675 20f3cdea0fd2
parent 6673 78f18a929123
child 6677 c3202c29e352
permissions -rw-r--r--
Add SDL_CreateSystemCursor for Windows and Linux.
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
6138
4c64952a58fb Happy New Year!
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
     3
  Copyright (C) 1997-2012 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.
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
    26
 *
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
    27
 *  Please note that this ONLY discusses "mice" with the notion of 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
    28
 *  desktop GUI. You (usually) have one system cursor, and the OS hides
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
    29
 *  the hardware details from you. If you plug in 10 mice, all ten move that
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
    30
 *  one cursor. For many applications and games, this is perfect, and this
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
    31
 *  API has served hundreds of SDL programs well since its birth.
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
    32
 *
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
    33
 *  It's not the whole picture, though. If you want more lowlevel control,
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
    34
 *  SDL offers a different API, that gives you visibility into each input
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
    35
 *  device, multi-touch interfaces, etc.
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
    36
 *
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
    37
 *  Those two APIs are incompatible, and you usually should not use both
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
    38
 *  at the same time. But for legacy purposes, this API refers to a "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
    39
 *  when it actually means the system pointer and not a physical 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
    40
 *
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
    41
 *  The other API is in SDL_input.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
    42
 */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    43
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    44
#ifndef _SDL_mouse_h
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    45
#define _SDL_mouse_h
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    46
1356
67114343400d *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 1330
diff changeset
    47
#include "SDL_stdinc.h"
1358
c71e05b4dc2e More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents: 1356
diff changeset
    48
#include "SDL_error.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    49
#include "SDL_video.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    50
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    51
#include "begin_code.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    52
/* Set up for C function definitions, even when using C++ */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    53
#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
    54
/* *INDENT-OFF* */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    55
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
    56
/* *INDENT-ON* */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    57
#endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    58
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
    59
typedef struct SDL_Cursor SDL_Cursor;   /* Implementation dependent */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    60
6675
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    61
/**
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    62
 * \brief Cursor types for SDL_CreateSystemCursor.
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    63
 */
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    64
typedef enum
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    65
{
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    66
    SDL_SYSTEM_CURSOR_ARROW,     // Arrow
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    67
    SDL_SYSTEM_CURSOR_IBEAM,     // I-beam
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    68
    SDL_SYSTEM_CURSOR_WAIT,      // Wait
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    69
    SDL_SYSTEM_CURSOR_CROSSHAIR, // Crosshair
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    70
    SDL_SYSTEM_CURSOR_WAITARROW, // Small wait cursor (or Wait if not available)
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    71
    SDL_SYSTEM_CURSOR_SIZENWSE,  // Double arrow pointing northwest and southeast
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    72
    SDL_SYSTEM_CURSOR_SIZENESW,  // Double arrow pointing northeast and southwest
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    73
    SDL_SYSTEM_CURSOR_SIZEWE,    // Double arrow pointing west and east
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    74
    SDL_SYSTEM_CURSOR_SIZENS,    // Double arrow pointing north and south
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    75
    SDL_SYSTEM_CURSOR_SIZEALL,   // Four pointed arrow pointing north, south, east, and west
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    76
    SDL_SYSTEM_CURSOR_NO,        // Slashed circle or crossbones
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    77
    SDL_SYSTEM_CURSOR_HAND,      // Hand
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
    78
} 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
    79
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    80
/* 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
    81
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
    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 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
    84
 */
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
    85
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
    86
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
    87
/**
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
    88
 *  \brief Retrieve the current state of the mouse.
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
    89
 *  
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
    90
 *  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
    91
 *  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
    92
 *  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
    93
 *  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
    94
 */
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
    95
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
    96
abacf2555bb4 Removed unneccesary code lines. Fixed mousename bug. Added lacking code in mousebutton
Szymon Wilczek <kazeuser@gmail.com>
parents: 2710
diff changeset
    97
/**
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
    98
 *  \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
    99
 *
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
 *  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
   101
 *  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
   102
 *  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
   103
 */
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
   104
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
   105
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
   106
/**
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
 *  \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
   108
 *  
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
   109
 *  \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
   110
 *  \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
   111
 *  \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
   112
 *  
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
   113
 *  \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
   114
 */
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
   115
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
   116
                                                   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
   117
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
 *  \brief Set relative mouse mode.
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   120
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   121
 *  \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
   122
 *
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   123
 *  \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
   124
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   125
 *  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
   126
 *  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
   127
 *  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
   128
 *  will not change.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   129
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   130
 *  \note This function will flush any pending mouse motion.
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
 *  \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
   133
 */
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
   134
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
   135
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
   136
/**
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
   137
 *  \brief Query whether relative mouse mode is enabled.
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   138
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   139
 *  \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
   140
 */
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
extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   142
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
   143
/**
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
   144
 *  \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
   145
 *         mask (in MSB format).
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   146
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   147
 *  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
   148
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   149
 *  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
   150
 *  <table>
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   151
 *  <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
   152
 *  <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
   153
 *  <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
   154
 *  <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
   155
 *  <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
   156
 *                                         if not. </td></tr>
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   157
 *  </table>
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   158
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   159
 *  \sa SDL_FreeCursor()
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   160
 */
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
   161
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
   162
                                                     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
   163
                                                     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
   164
                                                     int hot_y);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   165
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
   166
/**
5473
5665ccbd6792 Added a function to create color cursors: SDL_CreateColorCursor()
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   167
 *  \brief Create a color cursor.
5665ccbd6792 Added a function to create color cursors: SDL_CreateColorCursor()
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   168
 *  
5665ccbd6792 Added a function to create color cursors: SDL_CreateColorCursor()
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   169
 *  \sa SDL_FreeCursor()
5665ccbd6792 Added a function to create color cursors: SDL_CreateColorCursor()
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   170
 */
5665ccbd6792 Added a function to create color cursors: SDL_CreateColorCursor()
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   171
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
   172
                                                          int hot_x,
5665ccbd6792 Added a function to create color cursors: SDL_CreateColorCursor()
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   173
                                                          int hot_y);
5665ccbd6792 Added a function to create color cursors: SDL_CreateColorCursor()
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   174
5665ccbd6792 Added a function to create color cursors: SDL_CreateColorCursor()
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
   175
/**
6675
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
   176
 *  \brief Create a system cursor.
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
   177
 *
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
   178
 *  \sa SDL_FreeCursor()
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
   179
 */
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
   180
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
   181
20f3cdea0fd2 Add SDL_CreateSystemCursor for Windows and Linux.
Michael Sartain <mikesart@valvesoftware.com>
parents: 6673
diff changeset
   182
/**
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
   183
 *  \brief Set the active cursor.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   184
 */
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
   185
extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   186
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
   187
/**
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
   188
 *  \brief Return the active cursor.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   189
 */
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
   190
extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   191
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
   192
/**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   193
 *  \brief Frees a cursor created with SDL_CreateCursor().
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
 *  \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
   196
 */
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
   197
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
   198
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
   199
/**
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
   200
 *  \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
   201
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   202
 *  \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
   203
 *                state.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   204
 *  
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   205
 *  \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
   206
 */
337
9154ec9ca3d2 Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
   207
extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   208
2718
abacf2555bb4 Removed unneccesary code lines. Fixed mousename bug. Added lacking code in mousebutton
Szymon Wilczek <kazeuser@gmail.com>
parents: 2710
diff changeset
   209
/**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   210
 *  Used as a mask when testing buttons in buttonstate.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   211
 *   - Button 1:  Left mouse button
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   212
 *   - Button 2:  Middle mouse button
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   213
 *   - Button 3:  Right mouse button
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
   214
 */
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
   215
#define SDL_BUTTON(X)		(1 << ((X)-1))
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   216
#define SDL_BUTTON_LEFT		1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   217
#define SDL_BUTTON_MIDDLE	2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   218
#define SDL_BUTTON_RIGHT	3
2284
545fbf461c5b Fixed bug #464
Sam Lantinga <slouken@libsdl.org>
parents: 2242
diff changeset
   219
#define SDL_BUTTON_X1		4
545fbf461c5b Fixed bug #464
Sam Lantinga <slouken@libsdl.org>
parents: 2242
diff changeset
   220
#define SDL_BUTTON_X2		5
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   221
#define SDL_BUTTON_LMASK	SDL_BUTTON(SDL_BUTTON_LEFT)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   222
#define SDL_BUTTON_MMASK	SDL_BUTTON(SDL_BUTTON_MIDDLE)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   223
#define SDL_BUTTON_RMASK	SDL_BUTTON(SDL_BUTTON_RIGHT)
2284
545fbf461c5b Fixed bug #464
Sam Lantinga <slouken@libsdl.org>
parents: 2242
diff changeset
   224
#define SDL_BUTTON_X1MASK	SDL_BUTTON(SDL_BUTTON_X1)
545fbf461c5b Fixed bug #464
Sam Lantinga <slouken@libsdl.org>
parents: 2242
diff changeset
   225
#define SDL_BUTTON_X2MASK	SDL_BUTTON(SDL_BUTTON_X2)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   226
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   227
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   228
/* Ends C function definitions when using C++ */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   229
#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
   230
/* *INDENT-OFF* */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   231
}
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
   232
/* *INDENT-ON* */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   233
#endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   234
#include "close_code.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   235
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   236
#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
   237
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
   238
/* vi: set ts=4 sw=4 expandtab: */