diff options
Diffstat (limited to 'src/jake2')
-rw-r--r-- | src/jake2/client/VID.java | 8 | ||||
-rw-r--r-- | src/jake2/client/refexport_t.java | 4 | ||||
-rw-r--r-- | src/jake2/render/DummyRenderer.java | 6 | ||||
-rw-r--r-- | src/jake2/render/opengl/GLDriver.java | 4 | ||||
-rw-r--r-- | src/jake2/render/opengl/JoglDummyDriver.java | 4 | ||||
-rw-r--r-- | src/jake2/render/opengl/JoglES1Driver.java | 4 | ||||
-rw-r--r-- | src/jake2/render/opengl/JoglES2Driver.java | 4 | ||||
-rw-r--r-- | src/jake2/render/opengl/JoglGL2Driver.java | 4 | ||||
-rw-r--r-- | src/jake2/render/opengl/NEWTWin.java | 46 | ||||
-rw-r--r-- | src/jake2/sys/InputListener.java | 4 | ||||
-rw-r--r-- | src/jake2/sys/NEWTKBD.java | 4 |
11 files changed, 42 insertions, 50 deletions
diff --git a/src/jake2/client/VID.java b/src/jake2/client/VID.java index 19aff61..d34a967 100644 --- a/src/jake2/client/VID.java +++ b/src/jake2/client/VID.java @@ -43,8 +43,7 @@ import javax.media.nativewindow.util.Dimension; import javax.media.nativewindow.util.DimensionImmutable; import javax.media.nativewindow.util.SurfaceSize; -import com.jogamp.newt.ScreenMode; -import com.jogamp.newt.util.MonitorMode; +import com.jogamp.newt.MonitorMode; /** * VID is a video driver. @@ -490,13 +489,12 @@ public class VID extends Globals { }; static void initModeList() { - final List<ScreenMode> modes = re.getModeList(); + final List<MonitorMode> modes = re.getModeList(); final ArrayList<String> fs_resolutions_list = new ArrayList<String>(); final ArrayList<vidmode_t> fs_modes_list = new ArrayList<vidmode_t>(); final HashSet<DimensionImmutable> resSet = new HashSet<DimensionImmutable>(); for (int i = 0; i < modes.size(); i++) { - final ScreenMode sm = modes.get(modes.size() - 1 - i); // reverse order: low -> high res. - final MonitorMode mm = sm.getMonitorMode(); + final MonitorMode mm = modes.get(modes.size() - 1 - i); // reverse order: low -> high res. final SurfaceSize ss = mm.getSurfaceSize(); final DimensionImmutable m = ss.getResolution(); if( resSet.add(m) ) { diff --git a/src/jake2/client/refexport_t.java b/src/jake2/client/refexport_t.java index 7a2a8f0..2238e4b 100644 --- a/src/jake2/client/refexport_t.java +++ b/src/jake2/client/refexport_t.java @@ -35,7 +35,7 @@ import jake2.sys.KBD; import javax.media.nativewindow.util.Dimension; -import com.jogamp.newt.ScreenMode; +import com.jogamp.newt.MonitorMode; /** * refexport_t @@ -110,7 +110,7 @@ public interface refexport_t { int apiVersion(); - List<ScreenMode> getModeList(); + List<MonitorMode> getModeList(); KBD getKeyboardHandler(); } diff --git a/src/jake2/render/DummyRenderer.java b/src/jake2/render/DummyRenderer.java index 2bc2c2e..fcef2fd 100644 --- a/src/jake2/render/DummyRenderer.java +++ b/src/jake2/render/DummyRenderer.java @@ -12,7 +12,7 @@ import java.util.List; import javax.media.nativewindow.util.Dimension; -import com.jogamp.newt.ScreenMode; +import com.jogamp.newt.MonitorMode; import jake2.client.refdef_t; import jake2.client.refexport_t; @@ -173,8 +173,8 @@ public class DummyRenderer implements refexport_t { /* (non-Javadoc) * @see jake2.client.refexport_t#getModeList() */ - public List<ScreenMode> getModeList() { - return new ArrayList<ScreenMode>(); + public List<MonitorMode> getModeList() { + return new ArrayList<MonitorMode>(); } /* (non-Javadoc) diff --git a/src/jake2/render/opengl/GLDriver.java b/src/jake2/render/opengl/GLDriver.java index 0967576..d350811 100644 --- a/src/jake2/render/opengl/GLDriver.java +++ b/src/jake2/render/opengl/GLDriver.java @@ -6,7 +6,7 @@ import javax.media.nativewindow.util.Dimension; import jake2.qcommon.xcommand_t; -import com.jogamp.newt.ScreenMode; +import com.jogamp.newt.MonitorMode; public interface GLDriver { @@ -26,7 +26,7 @@ public interface GLDriver { void logNewFrame(); - List<ScreenMode> getModeList(); + List<MonitorMode> getModeList(); void updateScreen(xcommand_t callback); diff --git a/src/jake2/render/opengl/JoglDummyDriver.java b/src/jake2/render/opengl/JoglDummyDriver.java index 3316f2a..73620b2 100644 --- a/src/jake2/render/opengl/JoglDummyDriver.java +++ b/src/jake2/render/opengl/JoglDummyDriver.java @@ -33,7 +33,7 @@ import jake2.render.Base; import javax.media.nativewindow.util.Dimension; import javax.media.opengl.*; -import com.jogamp.newt.ScreenMode; +import com.jogamp.newt.MonitorMode; /** * JoglCommon @@ -51,7 +51,7 @@ public abstract class JoglDummyDriver extends DummyGL implements GLDriver { public abstract String getName(); - public List<ScreenMode> getModeList() { + public List<MonitorMode> getModeList() { if(null == newtWin) { throw new RuntimeException("NEWTWin not yet initialized."); } diff --git a/src/jake2/render/opengl/JoglES1Driver.java b/src/jake2/render/opengl/JoglES1Driver.java index d9001ae..f9a29f8 100644 --- a/src/jake2/render/opengl/JoglES1Driver.java +++ b/src/jake2/render/opengl/JoglES1Driver.java @@ -35,7 +35,7 @@ import jake2.render.Base; import javax.media.nativewindow.util.Dimension; import javax.media.opengl.*; -import com.jogamp.newt.ScreenMode; +import com.jogamp.newt.MonitorMode; /** * JoglCommon @@ -61,7 +61,7 @@ public abstract class JoglES1Driver extends JoglGL2ES1 implements GLDriver { public abstract String getName(); - public List<ScreenMode> getModeList() { + public List<MonitorMode> getModeList() { if(null == newtWin) { throw new RuntimeException("NEWTWin not yet initialized."); } diff --git a/src/jake2/render/opengl/JoglES2Driver.java b/src/jake2/render/opengl/JoglES2Driver.java index 3d63984..2548b62 100644 --- a/src/jake2/render/opengl/JoglES2Driver.java +++ b/src/jake2/render/opengl/JoglES2Driver.java @@ -35,7 +35,7 @@ import jake2.render.Base; import javax.media.nativewindow.util.Dimension; import javax.media.opengl.*; -import com.jogamp.newt.ScreenMode; +import com.jogamp.newt.MonitorMode; import com.jogamp.opengl.util.glsl.fixedfunc.FixedFuncUtil; import com.jogamp.opengl.util.glsl.fixedfunc.ShaderSelectionMode; @@ -66,7 +66,7 @@ public abstract class JoglES2Driver extends JoglGL2ES1 implements GLDriver { public abstract String getName(); - public List<ScreenMode> getModeList() { + public List<MonitorMode> getModeList() { if(null == newtWin) { throw new RuntimeException("NEWTWin not yet initialized."); } diff --git a/src/jake2/render/opengl/JoglGL2Driver.java b/src/jake2/render/opengl/JoglGL2Driver.java index 1fdcc8b..cad9c0a 100644 --- a/src/jake2/render/opengl/JoglGL2Driver.java +++ b/src/jake2/render/opengl/JoglGL2Driver.java @@ -35,7 +35,7 @@ import jake2.render.Base; import javax.media.nativewindow.util.Dimension; import javax.media.opengl.*; -import com.jogamp.newt.ScreenMode; +import com.jogamp.newt.MonitorMode; /** * JoglCommon @@ -61,7 +61,7 @@ public abstract class JoglGL2Driver extends JoglGL2ES1 implements GLDriver { public abstract String getName(); - public List<ScreenMode> getModeList() { + public List<MonitorMode> getModeList() { if(null == newtWin) { throw new RuntimeException("NEWTWin not yet initialized."); } diff --git a/src/jake2/render/opengl/NEWTWin.java b/src/jake2/render/opengl/NEWTWin.java index 2afecc4..bc514ed 100644 --- a/src/jake2/render/opengl/NEWTWin.java +++ b/src/jake2/render/opengl/NEWTWin.java @@ -28,36 +28,37 @@ import javax.media.opengl.GLProfile; import jogamp.opengl.FPSCounterImpl; import com.jogamp.common.os.Platform; -import com.jogamp.newt.NewtFactory; -import com.jogamp.newt.Screen; -import com.jogamp.newt.ScreenMode; +import com.jogamp.newt.*; import com.jogamp.newt.event.WindowAdapter; import com.jogamp.newt.event.WindowEvent; import com.jogamp.newt.opengl.GLWindow; -import com.jogamp.newt.util.MonitorMode; -import com.jogamp.newt.util.ScreenModeUtil; +import com.jogamp.newt.util.MonitorModeUtil; import com.jogamp.opengl.GenericGLCapabilitiesChooser; public class NEWTWin { - ScreenMode oldDisplayMode = null; + MonitorMode oldDisplayMode = null; volatile Screen screen = null; volatile GLWindow window = null; final FPSCounterImpl fpsCounter = new FPSCounterImpl(); - public List<ScreenMode> getModeList() { - return screen.getScreenModes(); + public List<MonitorMode> getModeList() { + if( null != window ) { + final MonitorDevice mainMonitor = window.getMainMonitor(); + return mainMonitor.getSupportedModes(); + } else { + return screen.getMonitorModes(); + } } - public ScreenMode findDisplayMode(DimensionImmutable dim) { - final List<ScreenMode> sml = ScreenModeUtil.filterByResolution(screen.getScreenModes(), dim); + public MonitorMode findDisplayMode(DimensionImmutable dim) { + final List<MonitorMode> sml = MonitorModeUtil.filterByResolution(getModeList(), dim); if(sml.size() == 0) { return oldDisplayMode; } return sml.get(0); } - public String getModeString(ScreenMode sm) { - final MonitorMode mm = sm.getMonitorMode(); + public String getModeString(MonitorMode mm) { final SurfaceSize ss = mm.getSurfaceSize(); final DimensionImmutable m = ss.getResolution(); final StringBuffer sb = new StringBuffer(); @@ -122,7 +123,9 @@ public class NEWTWin { window.addWindowListener(new WindowAdapter() { public void windowDestroyNotify(WindowEvent e) { if (!Globals.appletMode) { - Cbuf.ExecuteText(Defines.EXEC_APPEND, "quit"); + if( null != window ) { // already in shutdown ? + Cbuf.ExecuteText(Defines.EXEC_APPEND, "quit"); + } } } @@ -132,8 +135,10 @@ public class NEWTWin { }); window.setTitle("Jake2 ("+driverName+"-newt-"+glp.getName().toLowerCase()+")"); + final MonitorDevice mainMonitor = window.getMainMonitor(); + if (oldDisplayMode == null) { - oldDisplayMode = window.getScreen().getCurrentScreenMode(); + oldDisplayMode = mainMonitor.getCurrentMode(); } // We need to feed the NEWT Window to the NEWTKBD @@ -144,11 +149,11 @@ public class NEWTWin { window.addMouseListener(NEWTKBD.listener); if (fullscreen) { - ScreenMode sm = findDisplayMode(newDim); - final DimensionImmutable smDim = sm.getMonitorMode().getSurfaceSize().getResolution(); + MonitorMode mm = findDisplayMode(newDim); + final DimensionImmutable smDim = mm.getSurfaceSize().getResolution(); newDim.setWidth( smDim.getWidth() ); newDim.setHeight( smDim.getHeight() ); - window.getScreen().setCurrentScreenMode(sm); + mainMonitor.setCurrentMode(mm); window.setFullscreen(true); } else { window.setSize(newDim.getWidth(), newDim.getHeight()); @@ -222,12 +227,9 @@ public class NEWTWin { private void shutdownImpl(boolean withScreen) { if ( null != window ) { deactivateGLContext(); - if (!Globals.appletMode) { - window.destroy(); - } else { - window.destroy(); // same thing - } + final GLWindow _window = window; window = null; + _window.destroy(); // same thing } if( withScreen && null != screen ) { screen.destroy(); diff --git a/src/jake2/sys/InputListener.java b/src/jake2/sys/InputListener.java index 3efece2..bff13d5 100644 --- a/src/jake2/sys/InputListener.java +++ b/src/jake2/sys/InputListener.java @@ -62,10 +62,6 @@ public final class InputListener implements KeyListener, MouseListener, WindowLi } @Override - public void keyTyped(KeyEvent e) { - } - - @Override public void mouseClicked(MouseEvent e) { } diff --git a/src/jake2/sys/NEWTKBD.java b/src/jake2/sys/NEWTKBD.java index 594fee3..4a0ba76 100644 --- a/src/jake2/sys/NEWTKBD.java +++ b/src/jake2/sys/NEWTKBD.java @@ -133,16 +133,12 @@ final public class NEWTKBD extends KBD // 00635 case XK_KP_End: key = K_KP_END; break; case KeyEvent.VK_END: key = Key.K_END; break; - case KeyEvent.VK_KP_LEFT: key = Key.K_KP_LEFTARROW; break; case KeyEvent.VK_LEFT: key = Key.K_LEFTARROW; break; - case KeyEvent.VK_KP_RIGHT: key = Key.K_KP_RIGHTARROW; break; case KeyEvent.VK_RIGHT: key = Key.K_RIGHTARROW; break; - case KeyEvent.VK_KP_DOWN: key = Key.K_KP_DOWNARROW; break; case KeyEvent.VK_DOWN: key = Key.K_DOWNARROW; break; - case KeyEvent.VK_KP_UP: key = Key.K_KP_UPARROW; break; case KeyEvent.VK_UP: key = Key.K_UPARROW; break; case KeyEvent.VK_ESCAPE: key = Key.K_ESCAPE; break; |