include/SDL_mouse.h
changeset 0 74212992fb08
child 251 b8688cfdc232
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/include/SDL_mouse.h	Thu Apr 26 16:45:43 2001 +0000
     1.3 @@ -0,0 +1,136 @@
     1.4 +/*
     1.5 +    SDL - Simple DirectMedia Layer
     1.6 +    Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
     1.7 +
     1.8 +    This library is free software; you can redistribute it and/or
     1.9 +    modify it under the terms of the GNU Library General Public
    1.10 +    License as published by the Free Software Foundation; either
    1.11 +    version 2 of the License, or (at your option) any later version.
    1.12 +
    1.13 +    This library is distributed in the hope that it will be useful,
    1.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.16 +    Library General Public License for more details.
    1.17 +
    1.18 +    You should have received a copy of the GNU Library General Public
    1.19 +    License along with this library; if not, write to the Free
    1.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.21 +
    1.22 +    Sam Lantinga
    1.23 +    slouken@devolution.com
    1.24 +*/
    1.25 +
    1.26 +#ifdef SAVE_RCSID
    1.27 +static char rcsid =
    1.28 + "@(#) $Id$";
    1.29 +#endif
    1.30 +
    1.31 +/* Include file for SDL mouse event handling */
    1.32 +
    1.33 +#ifndef _SDL_mouse_h
    1.34 +#define _SDL_mouse_h
    1.35 +
    1.36 +#include "SDL_types.h"
    1.37 +#include "SDL_video.h"
    1.38 +
    1.39 +#include "begin_code.h"
    1.40 +/* Set up for C function definitions, even when using C++ */
    1.41 +#ifdef __cplusplus
    1.42 +extern "C" {
    1.43 +#endif
    1.44 +
    1.45 +typedef struct WMcursor WMcursor;	/* Implementation dependent */
    1.46 +typedef struct {
    1.47 +	SDL_Rect area;			/* The area of the mouse cursor */
    1.48 +	Sint16 hot_x, hot_y;		/* The "tip" of the cursor */
    1.49 +	Uint8 *data;			/* B/W cursor data */
    1.50 +	Uint8 *mask;			/* B/W cursor mask */
    1.51 +	Uint8 *save[2];			/* Place to save cursor area */
    1.52 +	WMcursor *wm_cursor;		/* Window-manager cursor */
    1.53 +} SDL_Cursor;
    1.54 +
    1.55 +/* Function prototypes */
    1.56 +/*
    1.57 + * Retrieve the current state of the mouse.
    1.58 + * The current button state is returned as a button bitmask, which can
    1.59 + * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
    1.60 + * current mouse cursor position.  You can pass NULL for either x or y.
    1.61 + */
    1.62 +extern DECLSPEC Uint8 SDL_GetMouseState(int *x, int *y);
    1.63 +
    1.64 +/*
    1.65 + * Retrieve the current state of the mouse.
    1.66 + * The current button state is returned as a button bitmask, which can
    1.67 + * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
    1.68 + * mouse deltas since the last call to SDL_GetRelativeMouseState().
    1.69 + */
    1.70 +extern DECLSPEC Uint8 SDL_GetRelativeMouseState(int *x, int *y);
    1.71 +
    1.72 +/*
    1.73 + * Set the position of the mouse cursor (generates a mouse motion event)
    1.74 + */
    1.75 +extern DECLSPEC void SDL_WarpMouse(Uint16 x, Uint16 y);
    1.76 +
    1.77 +/*
    1.78 + * Create a cursor using the specified data and mask (in MSB format).
    1.79 + * The cursor width must be a multiple of 8 bits.
    1.80 + *
    1.81 + * The cursor is created in black and white according to the following:
    1.82 + * data  mask    resulting pixel on screen
    1.83 + *  0     1       White
    1.84 + *  1     1       Black
    1.85 + *  0     0       Transparent
    1.86 + *  1     0       Inverted color if possible, black if not.
    1.87 + *
    1.88 + * Cursors created with this function must be freed with SDL_FreeCursor().
    1.89 + */
    1.90 +extern DECLSPEC SDL_Cursor *SDL_CreateCursor
    1.91 +		(Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
    1.92 +
    1.93 +/*
    1.94 + * Set the currently active cursor to the specified one.
    1.95 + * If the cursor is currently visible, the change will be immediately 
    1.96 + * represented on the display.
    1.97 + */
    1.98 +extern DECLSPEC void SDL_SetCursor(SDL_Cursor *cursor);
    1.99 +
   1.100 +/*
   1.101 + * Returns the currently active cursor.
   1.102 + */
   1.103 +extern DECLSPEC SDL_Cursor * SDL_GetCursor(void);
   1.104 +
   1.105 +/*
   1.106 + * Deallocates a cursor created with SDL_CreateCursor().
   1.107 + */
   1.108 +extern DECLSPEC void SDL_FreeCursor(SDL_Cursor *cursor);
   1.109 +
   1.110 +/*
   1.111 + * Toggle whether or not the cursor is shown on the screen.
   1.112 + * The cursor start off displayed, but can be turned off.
   1.113 + * SDL_ShowCursor() returns 1 if the cursor was being displayed
   1.114 + * before the call, or 0 if it was not.  You can query the current
   1.115 + * state by passing a 'toggle' value of -1.
   1.116 + */
   1.117 +extern DECLSPEC int SDL_ShowCursor(int toggle);
   1.118 +
   1.119 +/* Used as a mask when testing buttons in buttonstate
   1.120 +   Button 1:	Left mouse button
   1.121 +   Button 2:	Middle mouse button
   1.122 +   Button 3:	Right mouse button
   1.123 + */
   1.124 +#define SDL_BUTTON(X)		(SDL_PRESSED<<(X-1))
   1.125 +#define SDL_BUTTON_LEFT		1
   1.126 +#define SDL_BUTTON_MIDDLE	2
   1.127 +#define SDL_BUTTON_RIGHT	3
   1.128 +#define SDL_BUTTON_LMASK	SDL_BUTTON(SDL_BUTTON_LEFT)
   1.129 +#define SDL_BUTTON_MMASK	SDL_BUTTON(SDL_BUTTON_MIDDLE)
   1.130 +#define SDL_BUTTON_RMASK	SDL_BUTTON(SDL_BUTTON_RIGHT)
   1.131 +
   1.132 +
   1.133 +/* Ends C function definitions when using C++ */
   1.134 +#ifdef __cplusplus
   1.135 +}
   1.136 +#endif
   1.137 +#include "close_code.h"
   1.138 +
   1.139 +#endif /* _SDL_mouse_h */