public class ScreenshotAppState extends AbstractAppState implements ActionListener, SceneProcessor
initialized
Constructor and Description |
---|
ScreenshotAppState()
Using this constructor, the screenshot files will be written sequentially to the system
default storage folder.
|
ScreenshotAppState(java.lang.String filePath)
This constructor allows you to specify the output file path of the screenshot.
|
ScreenshotAppState(java.lang.String filePath,
long shotIndex)
This constructor allows you to specify the output file path of the screenshot and
a base index for the shot index.
|
ScreenshotAppState(java.lang.String filePath,
java.lang.String fileName)
This constructor allows you to specify the output file path of the screenshot.
|
ScreenshotAppState(java.lang.String filePath,
java.lang.String fileName,
long shotIndex)
This constructor allows you to specify the output file path of the screenshot and
a base index for the shot index.
|
Modifier and Type | Method and Description |
---|---|
void |
initialize(AppStateManager stateManager,
Application app)
Called by
AppStateManager when transitioning this AppState
from initializing to running.This will happen on the next iteration through the update loop after AppStateManager.attach(com.jme3.app.state.AppState) was called. |
void |
initialize(RenderManager rm,
ViewPort vp)
Called in the render thread to initialize the scene processor.
|
boolean |
isInitialized() |
void |
onAction(java.lang.String name,
boolean value,
float tpf)
Called when an input to which this listener is registered to is invoked.
|
void |
postFrame(FrameBuffer out)
Called after a frame has been rendered and the queue flushed.
|
void |
postQueue(RenderQueue rq)
Called after the scene graph has been queued, but before it is flushed.
|
void |
preFrame(float tpf)
Called before a frame
|
void |
reshape(ViewPort vp,
int w,
int h)
Called when the resolution of the viewport has been changed.
|
void |
setFileName(java.lang.String fileName)
Set the file name of the screenshot.
|
void |
setFilePath(java.lang.String filePath)
Set the file path to store the screenshot.
|
void |
setIsNumbered(boolean numberedWanted)
Sets if the filename should be appended with a number representing the
current sequence.
|
void |
setProfiler(AppProfiler profiler)
Sets a profiler Instance for this processor.
|
void |
setShotIndex(long index)
Sets the base index that will used for subsequent screen shots.
|
void |
takeScreenshot() |
protected void |
writeImageFile(java.io.File file)
Called by postFrame() once the screen has been captured to outBuf.
|
cleanup, getId, isEnabled, postRender, render, setEnabled, setId, stateAttached, stateDetached, update
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cleanup
public ScreenshotAppState()
public ScreenshotAppState(java.lang.String filePath)
filePath
- The screenshot file path to use. Include the separator at the end of the path.public ScreenshotAppState(java.lang.String filePath, java.lang.String fileName)
filePath
- The screenshot file path to use. Include the separator at the end of the path.fileName
- The name of the file to save the screenshot as.public ScreenshotAppState(java.lang.String filePath, long shotIndex)
filePath
- The screenshot file path to use. Include the separator at the end of the path.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(java.lang.String filePath, java.lang.String fileName, long shotIndex)
filePath
- The screenshot file path to use. Include the separator at the end of the path.fileName
- The name of the file to save the screenshot as.shotIndex
- The base index for screen shots. The first screen shot will have
shotIndex + 1 appended, the next shotIndex + 2, and so on.public void setFilePath(java.lang.String filePath)
filePath
- File path to use to store the screenshot. Include the separator at the end of the path.public void setFileName(java.lang.String fileName)
fileName
- File name to save the screenshot as.public void setShotIndex(long index)
public void setIsNumbered(boolean numberedWanted)
numberedWanted
- If numbering is wanted.public void initialize(AppStateManager stateManager, Application app)
AppState
AppStateManager
when transitioning this AppState
from initializing to running.AppStateManager.attach(com.jme3.app.state.AppState)
was called.
AppStateManager
will call this only from the update loop
inside the rendering thread. This means is it safe to modify the scene
graph from this method.
initialize
in interface AppState
initialize
in class AbstractAppState
stateManager
- The state managerapp
- The applicationpublic void onAction(java.lang.String name, boolean value, float tpf)
ActionListener
onAction
in interface ActionListener
name
- The name of the mapping that was invokedvalue
- True if the action is "pressed", false otherwisetpf
- The time per frame value.public void takeScreenshot()
public void initialize(RenderManager rm, ViewPort vp)
SceneProcessor
initialize
in interface SceneProcessor
rm
- The render manager to which the SP was added tovp
- The viewport to which the SP is assignedpublic boolean isInitialized()
isInitialized
in interface AppState
isInitialized
in interface SceneProcessor
isInitialized
in class AbstractAppState
initialize()
was called on the state,
false otherwise.public void reshape(ViewPort vp, int w, int h)
SceneProcessor
reshape
in interface SceneProcessor
public void preFrame(float tpf)
SceneProcessor
preFrame
in interface SceneProcessor
tpf
- Time per framepublic void postQueue(RenderQueue rq)
SceneProcessor
postQueue
in interface SceneProcessor
rq
- The render queuepublic void postFrame(FrameBuffer out)
SceneProcessor
postFrame
in interface SceneProcessor
out
- The FB to which the scene was rendered.public void setProfiler(AppProfiler profiler)
SceneProcessor
setProfiler
in interface SceneProcessor
profiler
- the profiler instance.protected void writeImageFile(java.io.File file) throws java.io.IOException
java.io.IOException