1 //-------------------------------------------------------------------------
2 /*
3 Copyright (C) 1996, 2003 - 3D Realms Entertainment
4 
5 This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
6 
7 Duke Nukem 3D is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
11 
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 
16 See the GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 
22 Original Source: 1996 - Todd Replogle
23 Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
24 Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
25 */
26 //-------------------------------------------------------------------------
27 
28 #pragma once
29 
30 #ifndef mouse_h_
31 #define mouse_h_
32 
33 #include "baselayer.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #define LEFT_MOUSE      1
40 #define RIGHT_MOUSE     2
41 #define MIDDLE_MOUSE    4
42 #define THUMB_MOUSE     8
43 #define WHEELUP_MOUSE   16
44 #define WHEELDOWN_MOUSE 32
45 
46 #define LEFT_MOUSE_PRESSED(button)      (((button)&LEFT_MOUSE) != 0)
47 #define RIGHT_MOUSE_PRESSED(button)     (((button)&RIGHT_MOUSE) != 0)
48 #define MIDDLE_MOUSE_PRESSED(button)    (((button)&MIDDLE_MOUSE) != 0)
49 
50 extern int32_t CONTROL_MouseAxesScale[2];
51 extern float   CONTROL_MouseSensitivity;
52 
MOUSE_Startup(void)53 static inline bool MOUSE_Startup(void)
54 {
55     mouseInit();
56     return ((inputdevices & 2) == 2);
57 }
58 
MOUSE_Shutdown(void)59 static inline void MOUSE_Shutdown(void) { mouseUninit(); }
MOUSE_GetButtons(void)60 static inline int32_t MOUSE_GetButtons(void) { return mouseReadButtons(); }
MOUSE_ClearButton(int32_t b)61 static inline void MOUSE_ClearButton(int32_t b) { g_mouseBits &= ~b; }
MOUSE_ClearAllButtons(void)62 static inline void MOUSE_ClearAllButtons(void) { g_mouseBits = 0; }
63 
64 #ifdef __cplusplus
65 }
66 #endif
67 #endif /* __mouse_h */
68