aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/client/VID.java
diff options
context:
space:
mode:
authorHolger Zickner <[email protected]>2005-01-12 08:36:21 +0000
committerHolger Zickner <[email protected]>2005-01-12 08:36:21 +0000
commit1994073e8784f5bbbad93b1609605d062150366c (patch)
tree0e285516a6e4afbe7bf8a475a1d938a475989ebe /src/jake2/client/VID.java
parente2eadea9cf1b94cf026421a228d30dd699f1a92f (diff)
dynamic video menu
Diffstat (limited to 'src/jake2/client/VID.java')
-rw-r--r--src/jake2/client/VID.java136
1 files changed, 29 insertions, 107 deletions
diff --git a/src/jake2/client/VID.java b/src/jake2/client/VID.java
index dccf1de..4241411 100644
--- a/src/jake2/client/VID.java
+++ b/src/jake2/client/VID.java
@@ -2,7 +2,7 @@
* VID.java
* Copyright (C) 2003
*
- * $Id: VID.java,v 1.13 2005-01-12 00:40:14 cawe Exp $
+ * $Id: VID.java,v 1.14 2005-01-12 08:36:21 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -435,62 +435,11 @@ public class VID extends Globals {
Cvar.SetValue( "gl_mode", s_mode_list.curvalue );
Cvar.SetValue( "_windowed_mouse", s_windowed_mouse.curvalue);
- switch ( s_ref_list.curvalue )
- {
-// case REF_SOFT:
-// Cvar_Set( "vid_ref", "soft" );
-// break;
-// case REF_SOFTX11:
-// Cvar_Set( "vid_ref", "softx" );
-// break;
-//
-// case REF_MESA3D :
-// Cvar_Set( "vid_ref", "gl" );
-// Cvar_Set( "gl_driver", "libMesaGL.so.2" );
-// if (gl_driver->modified)
-// vid_ref->modified = true;
-// break;
-//
-// case REF_OPENGLX :
-// Cvar_Set( "vid_ref", "glx" );
-// Cvar_Set( "gl_driver", "libGL.so" );
-// if (gl_driver->modified)
-// vid_ref->modified = true;
-// break;
-//
-// case REF_MESA3DGLX :
-// Cvar_Set( "vid_ref", "glx" );
-// Cvar_Set( "gl_driver", "libMesaGL.so.2" );
-// if (gl_driver->modified)
-// vid_ref->modified = true;
-// break;
-//
-// case REF_3DFXGL :
-// Cvar_Set( "vid_ref", "gl" );
-// Cvar_Set( "gl_driver", "lib3dfxgl.so" );
-// if (gl_driver->modified)
-// vid_ref->modified = true;
-// break;
- case REF_OPENGL_JOGL :
- Cvar.Set( "vid_ref", "jogl" );
- Cvar.Set( "gl_driver", "jogl" );
- if (gl_driver.modified)
- vid_ref.modified = true;
- break;
- case REF_OPENGL_FASTJOGL :
- Cvar.Set( "vid_ref", "fastjogl" );
- Cvar.Set( "gl_driver", "fastjogl" );
- if (gl_driver.modified)
- vid_ref.modified = true;
- break;
- case REF_OPENGL_LWJGL :
- Cvar.Set( "vid_ref", "lwjgl" );
- Cvar.Set( "gl_driver", "lwjgl" );
- if (gl_driver.modified)
- vid_ref.modified = true;
- break;
- }
-
+ Cvar.Set( "vid_ref", drivers[s_ref_list.curvalue] );
+ Cvar.Set( "gl_driver", drivers[s_ref_list.curvalue] );
+ if (gl_driver.modified)
+ vid_ref.modified = true;
+
Menu.ForceMenuOff();
}
@@ -512,18 +461,9 @@ public class VID extends Globals {
static String[] fs_resolutions;
static int mode_x;
- static final String[] refs =
- {
- // "[software ]",
- // "[software X11 ]",
- // "[Mesa 3-D 3DFX ]",
- // "[3DFXGL Miniport]",
- // "[OpenGL glX ]",
- // "[Mesa 3-D glX ]",
- "[OpenGL jogl ]",
- "[OpenGL fastjogl]",
- "[OpenGL lwjgl ]",
- };
+ static String[] refs;
+ static String[] drivers;
+
static final String[] yesno_names =
{
"no",
@@ -555,11 +495,26 @@ public class VID extends Globals {
}
}
+ private static void initRefs() {
+ drivers = Renderer.getDriverNames();
+ refs = new String[drivers.length];
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < drivers.length; i++) {
+ sb.setLength(0);
+ sb.append("[OpenGL ").append(drivers[i]);
+ while (sb.length() < 16) sb.append(" ");
+ sb.append("]");
+ refs[i] = sb.toString();
+ }
+ }
+
/*
** VID_MenuInit
*/
public static void MenuInit() {
+ initRefs();
+
if ( gl_driver == null )
gl_driver = Cvar.Get( "gl_driver", Renderer.getPreferedName(), 0 );
if ( gl_picmip == null )
@@ -597,45 +552,12 @@ public class VID extends Globals {
s_screensize_slider.curvalue = (int)(SCR.scr_viewsize.value/10);
-// if ( strcmp( vid_ref->string, "soft" ) == 0)
-// {
-// s_current_menu_index = SOFTWARE_MENU;
-// s_ref_list[0].curvalue = s_ref_list[1].curvalue = REF_SOFT;
-// }
- if ( vid_ref.string.equalsIgnoreCase("jogl"))
- {
- s_ref_list.curvalue = REF_OPENGL_JOGL;
- }
- else if ( vid_ref.string.equalsIgnoreCase("fastjogl"))
- {
- s_ref_list.curvalue = REF_OPENGL_FASTJOGL;
- }
- else if ( vid_ref.string.equalsIgnoreCase("lwjgl"))
- {
- s_ref_list.curvalue = REF_OPENGL_LWJGL;
+ for (int i = 0; i < drivers.length; i++) {
+ if (vid_ref.string.equals(drivers[i])) {
+ s_ref_list.curvalue = i;
+ }
}
-// else if (strcmp( vid_ref->string, "softx" ) == 0 )
-// {
-// s_current_menu_index = SOFTWARE_MENU;
-// s_ref_list[0].curvalue = s_ref_list[1].curvalue = REF_SOFTX11;
-// }
-// else if ( strcmp( vid_ref->string, "gl" ) == 0 )
-// {
-// s_current_menu_index = OPENGL_MENU;
-// if ( strcmp( gl_driver->string, "lib3dfxgl.so" ) == 0 )
-// s_ref_list[s_current_menu_index].curvalue = REF_3DFXGL;
-// else
-// s_ref_list[s_current_menu_index].curvalue = REF_MESA3D;
-// }
-// else if ( strcmp( vid_ref->string, "glx" ) == 0 )
-// {
-// s_current_menu_index = OPENGL_MENU;
-// if ( strcmp( gl_driver->string, "libMesaGL.so.2" ) == 0 )
-// s_ref_list[s_current_menu_index].curvalue = REF_MESA3DGLX;
-// else
-// s_ref_list[s_current_menu_index].curvalue = REF_OPENGLX;
-// }
-//
+
s_opengl_menu.x = (int)(viddef.width * 0.50f);
s_opengl_menu.nitems = 0;