| 1 | /* |
| 2 | * fg_cursor.c |
| 3 | * |
| 4 | * The mouse cursor related stuff. |
| 5 | * |
| 6 | * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved. |
| 7 | * Written by Pawel W. Olszta, <olszta@sourceforge.net> |
| 8 | * Creation date: Thu Dec 16 1999 |
| 9 | * |
| 10 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 11 | * copy of this software and associated documentation files (the "Software"), |
| 12 | * to deal in the Software without restriction, including without limitation |
| 13 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 14 | * and/or sell copies of the Software, and to permit persons to whom the |
| 15 | * Software is furnished to do so, subject to the following conditions: |
| 16 | * |
| 17 | * The above copyright notice and this permission notice shall be included |
| 18 | * in all copies or substantial portions of the Software. |
| 19 | * |
| 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 21 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 23 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
| 24 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 25 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 26 | */ |
| 27 | |
| 28 | #include <GL/freeglut.h> |
| 29 | #include "fg_internal.h" |
| 30 | |
| 31 | /* |
| 32 | * TODO BEFORE THE STABLE RELEASE: |
| 33 | * glutSetCursor() -- Win32 mappings are incomplete. |
| 34 | * |
| 35 | * It would be good to use custom mouse cursor shapes, and introduce |
| 36 | * an option to display them using glBitmap() and/or texture mapping, |
| 37 | * apart from the windowing system version. |
| 38 | */ |
| 39 | |
| 40 | /* -- PRIVATE FUNCTIONS --------------------------------------------------- */ |
| 41 | |
| 42 | extern void fgPlatformSetCursor ( SFG_Window *window, int cursorID ); |
| 43 | extern void fgPlatformWarpPointer ( int x, int y ); |
| 44 | |
| 45 | |
| 46 | |
| 47 | /* -- INTERNAL FUNCTIONS ---------------------------------------------------- */ |
| 48 | void fgSetCursor ( SFG_Window *window, int cursorID ) |
| 49 | { |
| 50 | fgPlatformSetCursor ( window, cursorID ); |
| 51 | } |
| 52 | |
| 53 | |
| 54 | /* -- INTERFACE FUNCTIONS -------------------------------------------------- */ |
| 55 | |
| 56 | /* |
| 57 | * Set the cursor image to be used for the current window |
| 58 | */ |
| 59 | void FGAPIENTRY glutSetCursor( int cursorID ) |
| 60 | { |
| 61 | FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutSetCursor" ); |
| 62 | FREEGLUT_EXIT_IF_NO_WINDOW ( "glutSetCursor" ); |
| 63 | |
| 64 | fgPlatformSetCursor ( fgStructure.CurrentWindow, cursorID ); |
| 65 | fgStructure.CurrentWindow->State.Cursor = cursorID; |
| 66 | } |
| 67 | |
| 68 | /* |
| 69 | * Moves the mouse pointer to given window coordinates |
| 70 | */ |
| 71 | void FGAPIENTRY glutWarpPointer( int x, int y ) |
| 72 | { |
| 73 | FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutWarpPointer" ); |
| 74 | FREEGLUT_EXIT_IF_NO_WINDOW ( "glutWarpPointer" ); |
| 75 | |
| 76 | fgPlatformWarpPointer ( x, y ); |
| 77 | } |
| 78 | |
| 79 | /*** END OF FILE ***/ |
| 80 | |