Pyrogenesis  trunk
cursor.h
Go to the documentation of this file.
1 /* Copyright (c) 2010 Wildfire Games
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining
4  * a copy of this software and associated documentation files (the
5  * "Software"), to deal in the Software without restriction, including
6  * without limitation the rights to use, copy, modify, merge, publish,
7  * distribute, sublicense, and/or sell copies of the Software, and to
8  * permit persons to whom the Software is furnished to do so, subject to
9  * the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 /*
24  * mouse cursor
25  */
26 
27 #ifndef INCLUDED_SYSDEP_CURSOR
28 #define INCLUDED_SYSDEP_CURSOR
29 
30 typedef void* sys_cursor;
31 
32 /**
33  * Create a cursor from the given color image.
34  *
35  * @param w,h Image dimensions [pixels]. the maximum value is
36  * implementation-defined; 32x32 is typical and safe.
37  * @param bgra_img cursor image (BGRA format, bottom-up).
38  * It is copied and can be freed after this call returns.
39  * @param hx,hy 'hotspot', i.e. offset from the upper-left corner to the
40  * position where mouse clicks are registered.
41  * @param cursor Is 0 if the return code indicates failure, otherwise
42  * a valid cursor that must be sys_cursor_free-ed when no longer needed.
43  **/
44 extern Status sys_cursor_create(int w, int h, void* bgra_img, int hx, int hy, sys_cursor* cursor);
45 
46 /**
47  * Create a transparent cursor (used to hide the system cursor).
48  *
49  * @param cursor is 0 if the return code indicates failure, otherwise
50  * a valid cursor that must be sys_cursor_free-ed when no longer needed.
51  **/
53 
54 /**
55  * override the current system cursor.
56  *
57  * @param cursor can be 0 to restore the default.
58  **/
59 extern Status sys_cursor_set(sys_cursor cursor);
60 
61 /**
62  * destroy the indicated cursor and frees its resources.
63  *
64  * @param cursor if currently in use, the default cursor is restored first.
65  **/
66 extern Status sys_cursor_free(sys_cursor cursor);
67 
68 /**
69  * reset any cached cursor data.
70  * on some systems, this is needed when resetting the SDL video subsystem.
71  **/
72 extern Status sys_cursor_reset();
73 
74 #endif // #ifndef INCLUDED_SYSDEP_CURSOR
void * sys_cursor
Definition: cursor.h:30
Status sys_cursor_create(int w, int h, void *bgra_img, int hx, int hy, sys_cursor *cursor)
Create a cursor from the given color image.
Definition: android.cpp:72
Status sys_cursor_reset()
reset any cached cursor data.
Definition: android.cpp:116
Status sys_cursor_create_empty(sys_cursor *cursor)
Create a transparent cursor (used to hide the system cursor).
Definition: android.cpp:85
i64 Status
Error handling system.
Definition: status.h:171
Status sys_cursor_set(sys_cursor cursor)
override the current system cursor.
Definition: android.cpp:93
Status sys_cursor_free(sys_cursor cursor)
destroy the indicated cursor and frees its resources.
Definition: android.cpp:105