From 87930e7075bef83c90a484623a451214ade16b8b Mon Sep 17 00:00:00 2001 From: "PSp..om" Date: Thu, 19 Sep 2013 04:09:16 +0000 Subject: [PATCH] Modified to allow the rolling index to be seeded so that the app can optionally set it so the screen shots don't get overwritten every time the app is restarted. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10793 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../jme3/app/state/ScreenshotAppState.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/engine/src/core/com/jme3/app/state/ScreenshotAppState.java b/engine/src/core/com/jme3/app/state/ScreenshotAppState.java index 740c2f303..a719563e0 100644 --- a/engine/src/core/com/jme3/app/state/ScreenshotAppState.java +++ b/engine/src/core/com/jme3/app/state/ScreenshotAppState.java @@ -63,7 +63,7 @@ public class ScreenshotAppState extends AbstractAppState implements ActionListen private RenderManager rm; private ByteBuffer outBuf; private String appName; - private int shotIndex = 0; + private long shotIndex = 0; private int width, height; /** @@ -85,6 +85,21 @@ public class ScreenshotAppState extends AbstractAppState implements ActionListen this.filePath = filePath; } + /** + * This constructor allows you to specify the output file path of the screenshot and + * a base index for the shot index. + * Include the seperator at the end of the path. + * Use an emptry string to use the application folder. Use NULL to use the system + * default storage folder. + * @param file The screenshot file path to use. Include the seperator at the end of the path. + * @param shotIndex The base index for screen shots. The first screen shot will have + * shotIndex + 1 appended, the next shotIndex + 2, and so on. + */ + public ScreenshotAppState(String filePath, long shotIndex) { + this.filePath = filePath; + this.shotIndex = shotIndex; + } + /** * Set the file path to store the screenshot. * Include the seperator at the end of the path. @@ -96,6 +111,13 @@ public class ScreenshotAppState extends AbstractAppState implements ActionListen this.filePath = filePath; } + /** + * Sets the base index that will used for subsequent screen shots. + */ + public void setShotIndex(long index) { + this.shotIndex = index; + } + @Override public void initialize(AppStateManager stateManager, Application app) { if (!super.isInitialized()){