aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Weisse <[email protected]>2006-11-22 15:05:39 +0000
committerCarsten Weisse <[email protected]>2006-11-22 15:05:39 +0000
commitb6b2ebd4ee974ff03943275fa20289a83b549161 (patch)
treeb2baf5b923bcba186d797350d64cea019ae90106
parent60a03cf93bfcafa6fc542bcaacd6fe0d28072caf (diff)
better driver dependent screenshot handling
-rw-r--r--src/jake2/render/JoglRenderer.java23
-rw-r--r--src/jake2/render/Jsr231Renderer.java15
-rw-r--r--src/jake2/render/LwjglRenderer.java12
-rw-r--r--src/jake2/render/RenderAPI.java2
-rw-r--r--src/jake2/render/basic/Main.java6
-rw-r--r--src/jake2/render/basic/Misc.java19
-rw-r--r--src/jake2/render/fast/Main.java6
-rw-r--r--src/jake2/render/fast/Misc.java12
-rw-r--r--src/jake2/render/opengl/GLDriver.java2
-rw-r--r--src/jake2/render/opengl/JoglDriver.java4
-rw-r--r--src/jake2/render/opengl/Jsr231Driver.java18
-rw-r--r--src/jake2/render/opengl/LwjglDriver.java4
12 files changed, 66 insertions, 57 deletions
diff --git a/src/jake2/render/JoglRenderer.java b/src/jake2/render/JoglRenderer.java
index 8d76d7b..f9b0ec1 100644
--- a/src/jake2/render/JoglRenderer.java
+++ b/src/jake2/render/JoglRenderer.java
@@ -2,7 +2,7 @@
* JoglRenderer.java
* Copyright (C) 2003
*
- * $Id: JoglRenderer.java,v 1.8 2006-11-21 00:51:22 cawe Exp $
+ * $Id: JoglRenderer.java,v 1.9 2006-11-22 15:05:39 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -314,14 +314,27 @@ final class JoglRenderer extends JoglDriver implements refexport_t, Ref {
appActivate(activate);
}
+ public void screenshot() {
+ if (contextInUse) {
+ impl.GL_ScreenShot_f();
+ } else {
+ updateScreen(new xcommand_t() {
+ public void execute() {
+ impl.GL_ScreenShot_f();
+ }
+ });
+ }
+
+ }
+
public int apiVersion() {
return Defines.API_VERSION;
}
- public KBD getKeyboardHandler() {
- return kbd;
- }
-
+ public KBD getKeyboardHandler() {
+ return kbd;
+ }
+
// ============================================================================
// Ref interface
// ============================================================================
diff --git a/src/jake2/render/Jsr231Renderer.java b/src/jake2/render/Jsr231Renderer.java
index 0513dcb..4c32648 100644
--- a/src/jake2/render/Jsr231Renderer.java
+++ b/src/jake2/render/Jsr231Renderer.java
@@ -2,7 +2,7 @@
* Jsr231Renderer.java
* Copyright (C) 2004
*
- * $Id: Jsr231Renderer.java,v 1.2 2006-11-21 00:51:22 cawe Exp $
+ * $Id: Jsr231Renderer.java,v 1.3 2006-11-22 15:05:39 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -214,21 +214,26 @@ final class Jsr231Renderer extends Jsr231Driver implements refexport_t, Ref {
public final void EndFrame() {
endFrame();
}
-
+
/**
* @see jake2.client.refexport_t#AppActivate(boolean)
*/
public final void AppActivate(boolean activate) {
appActivate(activate);
}
+
+ public void screenshot() {
+ activate();
+ impl.GL_ScreenShot_f();
+ }
public final int apiVersion() {
return Defines.API_VERSION;
}
- public KBD getKeyboardHandler() {
- return kbd;
- }
+ public KBD getKeyboardHandler() {
+ return kbd;
+ }
// ============================================================================
// Ref interface
// ============================================================================
diff --git a/src/jake2/render/LwjglRenderer.java b/src/jake2/render/LwjglRenderer.java
index 9490b2d..156d385 100644
--- a/src/jake2/render/LwjglRenderer.java
+++ b/src/jake2/render/LwjglRenderer.java
@@ -2,7 +2,7 @@
* LwjglRenderer.java
* Copyright (C) 2004
*
- * $Id: LwjglRenderer.java,v 1.3 2006-11-21 02:22:19 cawe Exp $
+ * $Id: LwjglRenderer.java,v 1.4 2006-11-22 15:05:39 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -216,14 +216,18 @@ final class LwjglRenderer extends LwjglDriver implements refexport_t, Ref {
public final void AppActivate(boolean activate) {
appActivate(activate);
}
+
+ public void screenshot() {
+ impl.GL_ScreenShot_f();
+ }
public final int apiVersion() {
return Defines.API_VERSION;
}
- public KBD getKeyboardHandler() {
- return kbd;
- }
+ public KBD getKeyboardHandler() {
+ return kbd;
+ }
// ============================================================================
// Ref interface
diff --git a/src/jake2/render/RenderAPI.java b/src/jake2/render/RenderAPI.java
index 6bf869b..3237d82 100644
--- a/src/jake2/render/RenderAPI.java
+++ b/src/jake2/render/RenderAPI.java
@@ -49,4 +49,6 @@ public interface RenderAPI {
void R_SetPalette(byte[] palette);
void R_BeginFrame(float camera_separation);
+
+ void GL_ScreenShot_f();
}
diff --git a/src/jake2/render/basic/Main.java b/src/jake2/render/basic/Main.java
index 9dfdaff..a099a78 100644
--- a/src/jake2/render/basic/Main.java
+++ b/src/jake2/render/basic/Main.java
@@ -2,7 +2,7 @@
* Main.java
* Copyright (C) 2003
*
- * $Id: Main.java,v 1.2 2006-11-21 00:50:46 cawe Exp $
+ * $Id: Main.java,v 1.3 2006-11-22 15:05:38 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -67,7 +67,7 @@ public abstract class Main extends Base {
protected abstract void Draw_GetPalette();
abstract void GL_ImageList_f();
- abstract void GL_ScreenShot_f();
+ public abstract void GL_ScreenShot_f();
abstract void GL_SetTexturePalette(int[] palette);
abstract void GL_Strings_f();
@@ -998,7 +998,7 @@ public abstract class Main extends Base {
Cmd.AddCommand("screenshot", new xcommand_t() {
public void execute() {
- GL_ScreenShot_f();
+ glImpl.screenshot();
}
});
Cmd.AddCommand("modellist", new xcommand_t() {
diff --git a/src/jake2/render/basic/Misc.java b/src/jake2/render/basic/Misc.java
index 5e185e2..e4ea57c 100644
--- a/src/jake2/render/basic/Misc.java
+++ b/src/jake2/render/basic/Misc.java
@@ -2,7 +2,7 @@
* Misc.java
* Copyright (C) 2003
*
- * $Id: Misc.java,v 1.2 2006-11-21 00:50:46 cawe Exp $
+ * $Id: Misc.java,v 1.3 2006-11-22 15:05:38 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -123,22 +123,7 @@ public final class Misc extends Mesh {
/**
* GL_ScreenShot_f
*/
- void GL_ScreenShot_f() {
- // TODO don't forget
-// if (contextInUse) {
-// screenshot_f();
-// } else {
-// updateScreen(screenshotCall);
-// }
- }
-
- private xcommand_t screenshotCall = new xcommand_t() {
- public void execute() {
- screenshot_f();
- }
- };
-
- private void screenshot_f() {
+ public void GL_ScreenShot_f() {
StringBuffer sb = new StringBuffer(FS.Gamedir() + "/scrshot/jake00.tga");
FS.CreatePath(sb.toString());
File file = new File(sb.toString());
diff --git a/src/jake2/render/fast/Main.java b/src/jake2/render/fast/Main.java
index a40bc94..1bb6d07 100644
--- a/src/jake2/render/fast/Main.java
+++ b/src/jake2/render/fast/Main.java
@@ -2,7 +2,7 @@
* Main.java
* Copyright (C) 2003
*
- * $Id: Main.java,v 1.3 2006-11-21 02:22:19 cawe Exp $
+ * $Id: Main.java,v 1.4 2006-11-22 15:05:39 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -64,7 +64,7 @@ public abstract class Main extends Base {
protected abstract void Draw_GetPalette();
abstract void GL_ImageList_f();
- abstract void GL_ScreenShot_f();
+ public abstract void GL_ScreenShot_f();
abstract void GL_SetTexturePalette(int[] palette);
abstract void GL_Strings_f();
@@ -991,7 +991,7 @@ public abstract class Main extends Base {
Cmd.AddCommand("screenshot", new xcommand_t() {
public void execute() {
- GL_ScreenShot_f();
+ glImpl.screenshot();
}
});
Cmd.AddCommand("modellist", new xcommand_t() {
diff --git a/src/jake2/render/fast/Misc.java b/src/jake2/render/fast/Misc.java
index d4df9af..e1b47e6 100644
--- a/src/jake2/render/fast/Misc.java
+++ b/src/jake2/render/fast/Misc.java
@@ -2,7 +2,7 @@
* Misc.java
* Copyright (C) 2003
*
- * $Id: Misc.java,v 1.2 2006-11-21 00:50:46 cawe Exp $
+ * $Id: Misc.java,v 1.3 2006-11-22 15:05:39 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -114,12 +114,10 @@ public final class Misc extends Mesh {
private final static int TGA_HEADER_SIZE = 18;
- /*
- ==================
- GL_ScreenShot_f
- ==================
- */
- void GL_ScreenShot_f() {
+ /**
+ * GL_ScreenShot_f
+ */
+ public void GL_ScreenShot_f() {
StringBuffer sb = new StringBuffer(FS.Gamedir() + "/scrshot/jake00.tga");
FS.CreatePath(sb.toString());
File file = new File(sb.toString());
diff --git a/src/jake2/render/opengl/GLDriver.java b/src/jake2/render/opengl/GLDriver.java
index 7f3ea56..8a8eb4c 100644
--- a/src/jake2/render/opengl/GLDriver.java
+++ b/src/jake2/render/opengl/GLDriver.java
@@ -25,5 +25,7 @@ public interface GLDriver {
java.awt.DisplayMode[] getModeList();
void updateScreen(xcommand_t callback);
+
+ void screenshot();
}
diff --git a/src/jake2/render/opengl/JoglDriver.java b/src/jake2/render/opengl/JoglDriver.java
index 53a6d47..45ab03e 100644
--- a/src/jake2/render/opengl/JoglDriver.java
+++ b/src/jake2/render/opengl/JoglDriver.java
@@ -2,7 +2,7 @@
* JoglCommon.java
* Copyright (C) 2004
*
- * $Id: JoglDriver.java,v 1.2 2006-11-21 00:49:54 cawe Exp $
+ * $Id: JoglDriver.java,v 1.3 2006-11-22 15:05:39 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -46,7 +46,7 @@ import net.java.games.jogl.*;
/**
* JoglCommon
*/
-public class JoglDriver extends JoglGL implements GLDriver, GLEventListener {
+public abstract class JoglDriver extends JoglGL implements GLDriver, GLEventListener {
protected JoglDriver() {
// see JoglRenderer
diff --git a/src/jake2/render/opengl/Jsr231Driver.java b/src/jake2/render/opengl/Jsr231Driver.java
index f4feddb..81ee169 100644
--- a/src/jake2/render/opengl/Jsr231Driver.java
+++ b/src/jake2/render/opengl/Jsr231Driver.java
@@ -2,7 +2,7 @@
* JoglCommon.java
* Copyright (C) 2004
*
- * $Id: Jsr231Driver.java,v 1.2 2006-11-21 00:49:54 cawe Exp $
+ * $Id: Jsr231Driver.java,v 1.3 2006-11-22 15:05:39 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -45,7 +45,7 @@ import javax.swing.JFrame;
/**
* JoglCommon
*/
-public class Jsr231Driver extends Jsr231GL implements GLDriver {
+public abstract class Jsr231Driver extends Jsr231GL implements GLDriver {
protected Jsr231Driver() {
// singleton
@@ -274,13 +274,13 @@ public class Jsr231Driver extends Jsr231GL implements GLDriver {
// do nothing
}
- /*
- * @see jake2.client.refexport_t#updateScreen()
- */
-
- public void updateScreen(xcommand_t callback) {
- callback.execute();
- }
+ /*
+ * @see jake2.client.refexport_t#updateScreen()
+ */
+
+ public void updateScreen(xcommand_t callback) {
+ callback.execute();
+ }
protected void activate() {
display.activate();
diff --git a/src/jake2/render/opengl/LwjglDriver.java b/src/jake2/render/opengl/LwjglDriver.java
index 04f30bf..c1084a7 100644
--- a/src/jake2/render/opengl/LwjglDriver.java
+++ b/src/jake2/render/opengl/LwjglDriver.java
@@ -2,7 +2,7 @@
* LWJGLBase.java
* Copyright (C) 2004
*
- * $Id: LwjglDriver.java,v 1.2 2006-11-21 00:49:54 cawe Exp $
+ * $Id: LwjglDriver.java,v 1.3 2006-11-22 15:05:39 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -43,7 +43,7 @@ import org.lwjgl.opengl.DisplayMode;
*
* @author dsanders/cwei
*/
-public class LwjglDriver extends LwjglGL implements GLDriver {
+public abstract class LwjglDriver extends LwjglGL implements GLDriver {
protected LwjglDriver() {
// see LwjglRenderer