aboutsummaryrefslogtreecommitdiff
path: root/backends/dc
diff options
context:
space:
mode:
authorMarcus Comstedt2005-04-03 21:41:39 +0000
committerMarcus Comstedt2005-04-03 21:41:39 +0000
commite62d6773ef629e11f966e4b4c3086db8cea58a0b (patch)
treeddddc80378ed13c071d093e1c0a8e1d9fbcfa020 /backends/dc
parent359c39722b2f18b6a6c12b90952117953b95bd39 (diff)
downloadscummvm-rg350-e62d6773ef629e11f966e4b4c3086db8cea58a0b.tar.gz
scummvm-rg350-e62d6773ef629e11f966e4b4c3086db8cea58a0b.tar.bz2
scummvm-rg350-e62d6773ef629e11f966e4b4c3086db8cea58a0b.zip
Added mouse wheel support.
svn-id: r17360
Diffstat (limited to 'backends/dc')
-rw-r--r--backends/dc/input.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/backends/dc/input.cpp b/backends/dc/input.cpp
index bc2b289b52..fa389c400a 100644
--- a/backends/dc/input.cpp
+++ b/backends/dc/input.cpp
@@ -33,6 +33,7 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,
int lmb=0, rmb=0, newkey=0;
static int lastkey = 0;
static byte lastlmb = 0, lastrmb = 0;
+ static int8 mouse_wheel = 0, lastwheel = 0;
shiftFlags = 0;
for(int i=0; i<4; i++, pad++)
if(pad->func & MAPLE_FUNC_CONTROLLER) {
@@ -68,12 +69,14 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,
mouse_x += pad->cond.mouse.axis1;
mouse_y += pad->cond.mouse.axis2;
+ mouse_wheel += pad->cond.mouse.axis3;
if(inter)
inter->mouse(mouse_x, mouse_y);
pad->cond.mouse.axis1 = 0;
pad->cond.mouse.axis2 = 0;
+ pad->cond.mouse.axis3 = 0;
} else if(pad->func & MAPLE_FUNC_KEYBOARD) {
for(int p=0; p<6; p++) {
int shift = pad->cond.kbd.shift;
@@ -152,6 +155,15 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y,
return -OSystem::EVENT_RBUTTONUP;
}
+ if(mouse_wheel != lastwheel)
+ if(((int8)(mouse_wheel - lastwheel)) > 0) {
+ lastwheel++;
+ return -OSystem::EVENT_WHEELDOWN;
+ } else {
+ --lastwheel;
+ return -OSystem::EVENT_WHEELUP;
+ }
+
if(newkey && inter && newkey != lastkey) {
int transkey = inter->key(newkey, shiftFlags);
if(transkey) {