diff options
Diffstat (limited to 'src/jake2/sys')
-rw-r--r-- | src/jake2/sys/InputListener.java | 10 | ||||
-rw-r--r-- | src/jake2/sys/Jake2InputEvent.java | 3 | ||||
-rw-r--r-- | src/jake2/sys/KBD.java | 13 |
3 files changed, 21 insertions, 5 deletions
diff --git a/src/jake2/sys/InputListener.java b/src/jake2/sys/InputListener.java index 40e58d5..2c60b38 100644 --- a/src/jake2/sys/InputListener.java +++ b/src/jake2/sys/InputListener.java @@ -2,7 +2,7 @@ * InputListener.java * Copyright (C) 2004 * - * $Id: InputListener.java,v 1.2 2004-07-19 19:22:57 hzi Exp $ + * $Id: InputListener.java,v 1.3 2004-11-03 08:53:27 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -31,7 +31,8 @@ import java.util.LinkedList; /** * InputListener */ -public final class InputListener implements KeyListener, MouseListener, MouseMotionListener, ComponentListener { +public final class InputListener implements KeyListener, MouseListener, + MouseMotionListener, ComponentListener, MouseWheelListener { // modifications of eventQueue must be thread safe! private static LinkedList eventQueue = new LinkedList(); @@ -101,7 +102,10 @@ public final class InputListener implements KeyListener, MouseListener, MouseMot IN.c = e.getComponent(); addEvent(new Jake2InputEvent(Jake2InputEvent.CreateNotify, e)); } - + + public void mouseWheelMoved(MouseWheelEvent e) { + addEvent(new Jake2InputEvent(Jake2InputEvent.WheelMoved, e)); + } } diff --git a/src/jake2/sys/Jake2InputEvent.java b/src/jake2/sys/Jake2InputEvent.java index 7da899f..32becf9 100644 --- a/src/jake2/sys/Jake2InputEvent.java +++ b/src/jake2/sys/Jake2InputEvent.java @@ -2,7 +2,7 @@ * Jake2InputEvent.java * Copyright (C) 2004 * - * $Id: Jake2InputEvent.java,v 1.1 2004-07-07 19:59:51 hzi Exp $ + * $Id: Jake2InputEvent.java,v 1.2 2004-11-03 08:53:27 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -38,6 +38,7 @@ class Jake2InputEvent { static final int ButtonRelease = 4; static final int CreateNotify = 5; static final int ConfigureNotify = 6; + static final int WheelMoved = 7; int type; AWTEvent ev; diff --git a/src/jake2/sys/KBD.java b/src/jake2/sys/KBD.java index ab9d062..b88e2e3 100644 --- a/src/jake2/sys/KBD.java +++ b/src/jake2/sys/KBD.java @@ -2,7 +2,7 @@ * KBD.java * Copyright (C) 2004 * - * $Id: KBD.java,v 1.3 2004-10-31 13:56:17 cawe Exp $ + * $Id: KBD.java,v 1.4 2004-11-03 08:53:27 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -101,6 +101,17 @@ public final class KBD { Do_Key_Event(Key.K_MOUSE1 + b, false); break; + case Jake2InputEvent.WheelMoved: + int dir = ((MouseWheelEvent)event.ev).getWheelRotation(); + if (dir > 0) { + Do_Key_Event(Key.K_MWHEELDOWN, true); + Do_Key_Event(Key.K_MWHEELDOWN, false); + } else { + Do_Key_Event(Key.K_MWHEELUP, true); + Do_Key_Event(Key.K_MWHEELUP, false); + } + break; + case Jake2InputEvent.CreateNotify : case Jake2InputEvent.ConfigureNotify : Component c = ((ComponentEvent)event.ev).getComponent(); |