diff options
author | Sven Gothel <[email protected]> | 2012-10-08 10:44:05 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-10-08 10:44:05 +0200 |
commit | f5612e7dfc635359f15b402c2ee9022a5e703a9d (patch) | |
tree | 0b54287f72b87a2693f38ed308195e928311a093 /src/jake2/client | |
parent | 3119458b32c8620f971ba44488389ddf03b2d705 (diff) |
Simple NEWT port: Remove AWT dependencies in Jake2 / JOGL / Fast (default mode) - Prepare for ES2NEWT
- Removed AWT init dialog, replaced w/ UI less auto install if n/a @ default location:
$HOME/Jake2/baseq2
- JOGL GL2 Renderer 'joglgl2'
- JOGL ES2 Renderer 'jogles2' (TBD)
- Replaced JOGLKBD (AWT) w/ NEWTKBD
- JOGL* Renderer using NEWT
Diffstat (limited to 'src/jake2/client')
-rw-r--r-- | src/jake2/client/Menu.java | 19 | ||||
-rw-r--r-- | src/jake2/client/SCR.java | 21 | ||||
-rw-r--r-- | src/jake2/client/VID.java | 23 | ||||
-rw-r--r-- | src/jake2/client/refexport_t.java | 7 |
4 files changed, 39 insertions, 31 deletions
diff --git a/src/jake2/client/Menu.java b/src/jake2/client/Menu.java index 7cc6f9c..5b4c589 100644 --- a/src/jake2/client/Menu.java +++ b/src/jake2/client/Menu.java @@ -31,15 +31,14 @@ import jake2.game.cvar_t; import jake2.qcommon.*; import jake2.sound.S; import jake2.sys.*; -import jake2.sys.NET; -import jake2.sys.Sys; import jake2.util.*; -import java.awt.Dimension; import java.io.RandomAccessFile; import java.util.Arrays; import java.util.Comparator; +import javax.media.nativewindow.util.Dimension; + /** * Menu * @@ -177,7 +176,7 @@ public final class Menu extends Key { Dimension dim = new Dimension(); Globals.re.DrawGetPicSize(dim, name); - Globals.re.DrawPic(viddef.getWidth() / 2 - dim.width / 2, + Globals.re.DrawPic(viddef.getWidth() / 2 - dim.getWidth() / 2, viddef.getHeight() / 2 - 110, name); } @@ -446,8 +445,8 @@ public final class Menu extends Key { for (i = 0; i < names.length; i++) { Globals.re.DrawGetPicSize(dim, names[i]); - w = dim.width; - h = dim.height; + w = dim.getWidth(); + h = dim.getHeight(); if (w > widest) widest = w; @@ -470,8 +469,8 @@ public final class Menu extends Key { (int) ((Globals.cls.realtime / 100)) % NUM_CURSOR_FRAMES); Globals.re.DrawGetPicSize(dim, "m_main_plaque"); - w = dim.width; - h = dim.height; + w = dim.getWidth(); + h = dim.getHeight(); Globals.re.DrawPic(xoffset - 30 - w, ystart, "m_main_plaque"); Globals.re.DrawPic(xoffset - 30 - w, ystart + h + 5, "m_main_logo"); @@ -4232,8 +4231,8 @@ public final class Menu extends Key { int w, h; Dimension d = new Dimension(); re.DrawGetPicSize(d, "quit"); - w = d.width; - h = d.height; + w = d.getWidth(); + h = d.getHeight(); re.DrawPic((viddef.getWidth() - w) / 2, (viddef.getHeight() - h) / 2, "quit"); } diff --git a/src/jake2/client/SCR.java b/src/jake2/client/SCR.java index fb4121c..50cd74c 100644 --- a/src/jake2/client/SCR.java +++ b/src/jake2/client/SCR.java @@ -33,11 +33,12 @@ import jake2.sound.S; import jake2.sys.Timer; import jake2.util.Vargs; -import java.awt.Dimension; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.Arrays; +import javax.media.nativewindow.util.Dimension; + /** * SCR */ @@ -489,7 +490,7 @@ public final class SCR extends Globals { return; re.DrawGetPicSize(dim, "pause"); - re.DrawPic((viddef.getWidth() - dim.width) / 2, viddef.getHeight() / 2 + 8, + re.DrawPic((viddef.getWidth() - dim.getWidth()) / 2, viddef.getHeight() / 2 + 8, "pause"); } @@ -504,8 +505,8 @@ public final class SCR extends Globals { scr_draw_loading = 0; re.DrawGetPicSize(dim, "loading"); - re.DrawPic((viddef.getWidth() - dim.width) / 2, - (viddef.getHeight() - dim.height) / 2, "loading"); + re.DrawPic((viddef.getWidth() - dim.getWidth()) / 2, + (viddef.getHeight() - dim.getHeight()) / 2, "loading"); } // ============================================================================= @@ -769,8 +770,8 @@ public final class SCR extends Globals { } - dim.width = width * 8; - dim.height = lines * 8; + dim.setWidth(width * 8); + dim.setHeight(lines * 8); } static void DrawHUDString(String string, int x, int y, int centerwidth, @@ -864,8 +865,8 @@ public final class SCR extends Globals { crosshair_pic = "ch" + (int) crosshair.value; Dimension dim = new Dimension(); re.DrawGetPicSize(dim, crosshair_pic); - crosshair_width = dim.width; - crosshair_height = dim.height; + crosshair_width = dim.getWidth(); + crosshair_height = dim.getHeight(); if (crosshair_width == 0) crosshair_pic = ""; } @@ -1214,8 +1215,8 @@ public final class SCR extends Globals { re.CinematicSetPalette(null); scr_draw_loading = 0; // false re.DrawGetPicSize(dim, "loading"); - re.DrawPic((viddef.getWidth() - dim.width) / 2, - (viddef.getHeight() - dim.height) / 2, "loading"); + re.DrawPic((viddef.getWidth() - dim.getWidth()) / 2, + (viddef.getHeight() - dim.getHeight()) / 2, "loading"); } // if a cinematic is supposed to be running, handle menus // and console specially diff --git a/src/jake2/client/VID.java b/src/jake2/client/VID.java index 6af2220..f27d4f3 100644 --- a/src/jake2/client/VID.java +++ b/src/jake2/client/VID.java @@ -35,8 +35,12 @@ import jake2.sound.S; import jake2.sys.IN; import jake2.util.Vargs; -import java.awt.Dimension; -import java.awt.DisplayMode; +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; /** * VID is a video driver. @@ -137,8 +141,8 @@ public class VID extends Globals { if (mode < 0 || mode >= modes.length) return false; - dim.width = modes[mode].width; - dim.height = modes[mode].height; + dim.setWidth( modes[mode].width ); + dim.setHeight( modes[mode].height ); return true; } @@ -482,12 +486,15 @@ public class VID extends Globals { }; static void initModeList() { - DisplayMode[] modes = re.getModeList(); + ScreenMode[] modes = re.getModeList(); fs_resolutions = new String[modes.length]; fs_modes = new vidmode_t[modes.length]; for (int i = 0; i < modes.length; i++) { - DisplayMode m = modes[i]; - StringBuffer sb = new StringBuffer(18); + final ScreenMode sm = modes[i]; + final MonitorMode mm = sm.getMonitorMode(); + final SurfaceSize ss = mm.getSurfaceSize(); + final DimensionImmutable m = ss.getResolution(); + final StringBuffer sb = new StringBuffer(); sb.append('['); sb.append(m.getWidth()); sb.append(' '); @@ -704,7 +711,7 @@ public class VID extends Globals { */ Dimension dim = new Dimension(); re.DrawGetPicSize( dim, "m_banner_video" ); - re.DrawPic( viddef.getWidth() / 2 - dim.width / 2, viddef.getHeight() /2 - 110, "m_banner_video" ); + re.DrawPic( viddef.getWidth() / 2 - dim.getWidth() / 2, viddef.getHeight() /2 - 110, "m_banner_video" ); /* ** move cursor to a reasonable starting position diff --git a/src/jake2/client/refexport_t.java b/src/jake2/client/refexport_t.java index a5c3b25..3cde83e 100644 --- a/src/jake2/client/refexport_t.java +++ b/src/jake2/client/refexport_t.java @@ -31,8 +31,9 @@ import jake2.render.image_t; import jake2.render.model_t; import jake2.sys.KBD; -import java.awt.Dimension; -import java.awt.DisplayMode; +import javax.media.nativewindow.util.Dimension; + +import com.jogamp.newt.ScreenMode; /** * refexport_t @@ -107,7 +108,7 @@ public interface refexport_t { int apiVersion(); - DisplayMode[] getModeList(); + ScreenMode[] getModeList(); KBD getKeyboardHandler(); } |