2
* mouse.h - Mouse handling for Unix-Systems.
5
* Oliver Schaertel <orschaer@forwiss.uni-erlangen.de>
7
* This file is part of VICE, the Versatile Commodore Emulator.
8
* See README for copyright notice.
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32
extern int mouse_resources_init(void);
33
extern int mouse_cmdline_options_init(void);
34
extern int mouse_init(void);
35
extern void mouse_button(int bnumber, int state);
38
extern int _mouse_enabled;
39
extern int mouse_x, mouse_y;
40
extern int mouse_accel;
42
/* ------------------------------------------------------------------------- */
44
inline static BYTE mouse_get_x(void)
46
static int last_mouse_x=0;
48
if(last_mouse_x - mouse_x > 16) {
50
return (BYTE) ((last_mouse_x * mouse_accel) >> 1) & 0x7e;
52
if(last_mouse_x - mouse_x < -16) {
54
return (BYTE) ((last_mouse_x * mouse_accel) >> 1) & 0x7e;
56
last_mouse_x = mouse_x;
57
return (BYTE) ((last_mouse_x * mouse_accel) >> 1) & 0x7e;
60
inline static BYTE mouse_get_y(void)
62
static int last_mouse_y=0;
64
if(last_mouse_y - mouse_y > 16) {
66
return (BYTE) ((last_mouse_y * mouse_accel) >> 1) & 0x7e;
68
if(last_mouse_y - mouse_y < -16) {
70
return (BYTE) ((last_mouse_y * mouse_accel) >> 1) & 0x7e;
72
last_mouse_y = mouse_y;
73
return (BYTE) ((last_mouse_y * mouse_accel) >> 1) & 0x7e;
76
inline static void mouse_move(int x, int y)
79
if (! _mouse_enabled) return;