diff options
author | Holger Zickner <[email protected]> | 2004-11-03 08:53:27 +0000 |
---|---|---|
committer | Holger Zickner <[email protected]> | 2004-11-03 08:53:27 +0000 |
commit | 5634134db18049e3d44e0aa4cda7b871a4ea7a40 (patch) | |
tree | 864b37646674cdb59884a26bfe6a5abdac056f34 | |
parent | 24284e5926af9dd90414ac57fe7c764128ffe13c (diff) |
mouse wheel support
-rw-r--r-- | src/jake2/qcommon/Qcommon.java | 12 | ||||
-rw-r--r-- | src/jake2/render/JoglBase.java | 3 | ||||
-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 |
5 files changed, 27 insertions, 14 deletions
diff --git a/src/jake2/qcommon/Qcommon.java b/src/jake2/qcommon/Qcommon.java index b89ee07..d4072fa 100644 --- a/src/jake2/qcommon/Qcommon.java +++ b/src/jake2/qcommon/Qcommon.java @@ -2,7 +2,7 @@ * Qcommon.java * Copyright 2003 * - * $Id: Qcommon.java,v 1.11 2004-10-28 21:31:31 cawe Exp $ + * $Id: Qcommon.java,v 1.12 2004-11-03 08:53:27 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -77,13 +77,7 @@ public final class Qcommon extends Globals { FS.InitFilesystem(); Jake2.Q2Dialog.setStatus("loading config..."); - Cbuf.AddText("exec default.cfg\n"); - Cbuf.Execute(); - Cvar.Set("vid_fullscreen", "0"); - Cbuf.AddText("exec config.cfg\n"); - - Cbuf.AddEarlyCommands(true); - Cbuf.Execute(); + reconfigure(); FS.setCDDir(); // use cddir from config.cfg FS.markBaseSearchPaths(); // mark the default search paths @@ -241,6 +235,8 @@ public final class Qcommon extends Globals { static void reconfigure() { Cbuf.AddText("exec default.cfg\n"); + Cbuf.AddText("bind MWHEELUP weapnext\n"); + Cbuf.AddText("bind MWHEELDOWN weapprev\n"); Cbuf.Execute(); Cvar.Set("vid_fullscreen", "0"); Cbuf.AddText("exec config.cfg\n"); diff --git a/src/jake2/render/JoglBase.java b/src/jake2/render/JoglBase.java index e489a74..4388209 100644 --- a/src/jake2/render/JoglBase.java +++ b/src/jake2/render/JoglBase.java @@ -2,7 +2,7 @@ * JoglCommon.java * Copyright (C) 2004 * - * $Id: JoglBase.java,v 1.11 2004-10-31 19:55:07 hzi Exp $ + * $Id: JoglBase.java,v 1.12 2004-11-03 08:53:27 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -231,6 +231,7 @@ public abstract class JoglBase implements GLEventListener { canvas.addKeyListener(KBD.listener); canvas.addMouseListener(KBD.listener); canvas.addMouseMotionListener(KBD.listener); + canvas.addMouseWheelListener(KBD.listener); if (fullscreen) { 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(); |