1661 |
mateusz.vi |
1 |
/*
|
|
|
2 |
* Mouse routines
|
|
|
3 |
*
|
|
|
4 |
* This file is part of the Mateusz' DOS Routines (MDR): http://mdr.osdn.io
|
|
|
5 |
* Published under the terms of the MIT License, as stated below.
|
|
|
6 |
*
|
|
|
7 |
* Copyright (C) 2014-2023 Mateusz Viste
|
|
|
8 |
*
|
|
|
9 |
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
10 |
* of this software and associated documentation files (the "Software"), to
|
|
|
11 |
* deal in the Software without restriction, including without limitation the
|
|
|
12 |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
13 |
* sell copies of the Software, and to permit persons to whom the Software is
|
|
|
14 |
* furnished to do so, subject to the following conditions:
|
|
|
15 |
*
|
|
|
16 |
* The above copyright notice and this permission notice shall be included in
|
|
|
17 |
* all copies or substantial portions of the Software.
|
|
|
18 |
*
|
|
|
19 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
20 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
21 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
22 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
23 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
24 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
25 |
* IN THE SOFTWARE.
|
|
|
26 |
*/
|
|
|
27 |
|
|
|
28 |
#ifndef MDR_MOUSE_H
|
|
|
29 |
#define MDR_MOUSE_H
|
|
|
30 |
|
|
|
31 |
/* init the mouse driver (and checks for presence of mouse support at same time)
|
|
|
32 |
* returns 0 if no mouse is present, and the number of buttons otherwise.
|
|
|
33 |
* after initialization the mouse cursor is hidden, use mdr_mouse_show() to
|
|
|
34 |
* make it visible. */
|
|
|
35 |
int mdr_mouse_init(void);
|
|
|
36 |
|
|
|
37 |
/* shows the mouse pointer */
|
|
|
38 |
void mdr_mouse_show(void);
|
|
|
39 |
|
|
|
40 |
/* hides the mouse pointer */
|
|
|
41 |
void mdr_mouse_hide(void);
|
|
|
42 |
|
|
|
43 |
/* get x/y coordinates of the mouse, and returns a bitfield with state of buttons */
|
|
|
44 |
int mdr_mouse_getstate(int *x, int *y);
|
|
|
45 |
|
|
|
46 |
/* get x/y coordinates of the mouse when the last button release occured since last check.
|
|
|
47 |
returns the id of the button pressed (1 or 2), or 0 if no event occured. */
|
|
|
48 |
int mdr_mouse_fetchrelease(int *x, int *y);
|
|
|
49 |
|
|
|
50 |
/* set graphic pointer shape. icon is 64-bytes long, two sets of 32. each set
|
|
|
51 |
* of 32 bytes is organized as a 16x16 bitmap, ie. 16 rows of 16-bit values.
|
|
|
52 |
* a) the first set of 16 shorts defines the background mask - that is, the
|
|
|
53 |
* background will show through wherever there is a 1-bit in that data.
|
|
|
54 |
* b) the second set defines the "XOR mask" - that is, the pixels matching the
|
|
|
55 |
* 1-bit in this data set are toggled.
|
|
|
56 |
* hotspotx and hotspoty define respectively the horizontal and vertical hot
|
|
|
57 |
* spot of the pointer (default being [0,0], that is the top left corner). */
|
|
|
58 |
void mdr_mouse_setcursor(const unsigned short *icon, unsigned char hotspotx, unsigned char hotspoty);
|
|
|
59 |
|
|
|
60 |
#endif
|