|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--gamingtools.GraphicsSource
The GraphicsSource class provides methods for entering and
exiting full-screen exclusive mode and for registering for animation
frame rendering callbacks. All of the methods of this class are static.
| Field Summary | |
static WindowAdapter |
DEFAULT_WINDOW_LISTENER
Used when the application runs in a window instead of full-screen exclusive mode. |
| Method Summary | |
static void |
clearRenderListener()
Unregisters the RenderListener if there is one. |
static void |
enterDisplayMode(int width,
int height)
Attempts to enter full-screen exclusive mode with the specified screen dimensions. |
static void |
exitDisplayMode()
Restores the display mode back to normal and stops the animation. |
static int |
getBufferHeight()
Obtains the height of the buffers. |
static int |
getBufferWidth()
Obtains the width of the buffers. |
static ExceptionHandler |
getExceptionHandler()
Obtains the ExceptionHandler used when an exception is thrown
in the animation loop thread. |
static Frame |
getFrame()
Obtains the Frame used as the full-screen window. |
static boolean |
isPageFlipping()
Returns whether or not page flipping is used as the double-buffer strategy. |
static void |
setExceptionHandler(ExceptionHandler exceptionHandler)
Sets the ExceptionHandler used when an exception is thrown
in the animation loop thread. |
static void |
setRenderListener(RenderListener renderListener)
Sets the RenderListener used for generating animation
frames. |
static void |
startAnimation(int framesPerSecond)
Starts the animation loop. |
static void |
startAnimation(int framesPerSecond,
int maxFrameSkips)
Starts the animation loop. |
static void |
stopAnimation()
Stops the animation loop. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final WindowAdapter DEFAULT_WINDOW_LISTENER
| Method Detail |
public static void setRenderListener(RenderListener renderListener)
Sets the RenderListener used for generating animation
frames.
This method invokes init() on a different thread than the
calling thread. This enables init() to perform blocking
calls, such as loading images and sounds, while an animation continues
to run. After init() completes, GraphicsSource
switches over to the specified RenderListener.
renderListener - RenderListener used for generating
animation frames. Or, null to switch back to the default
RenderListener. The default RenderListener
simply paints the buffers completely black.clearRenderListener()public static void clearRenderListener()
RenderListener if there is one. This method is
equivalent to passing null to
setRenderListener().
setRenderListener(RenderListener)public static void startAnimation(int framesPerSecond)
framesPerSecond - The apparent frame rate in fps.
public static void startAnimation(int framesPerSecond,
int maxFrameSkips)
framesPerSecond - The apparent frame rate in fps.maxFrameSkips - Maximum number of frames to skip. Use 0 to indicate
no frame skipping.public static void stopAnimation()
public static void enterDisplayMode(int width,
int height)
Attempts to enter full-screen exclusive mode with the specified screen dimensions. Of all available display modes, it enters the one with the highest bit depth and refresh rate. Bit depth is considered a higher priority.
If full-screen exclusive mode is unobtainable, it generates a
Frame with a visible drawing surface of the specified size
and the program will run outside of full-screen exclusive mode.
width - Width of full screen size.height - Height of full screen size.getFrame(),
DEFAULT_WINDOW_LISTENERpublic static void exitDisplayMode()
public static boolean isPageFlipping()
RenderListener will
always be passed a graphics context to the non-visible buffer. After the
frame is drawn, it will be displayed in one of two ways. If page flipping
is used, then the buffers are instantly swapped by adjusting the video
pointer to the opposite buffer; so, even and odd frames are drawn to
different buffers. If page flipping is not used, then the contents of the
non-visible buffer is copied to the visible one; meaning that drawing
always occurs on the same buffer. The value that this method returns is
important because it determines how to clean up the buffer to draw the
next animation frame.
true if page flipping is used as the double-buffer
strategy.public static Frame getFrame()
Frame used as the full-screen window.
public static void setExceptionHandler(ExceptionHandler exceptionHandler)
ExceptionHandler used when an exception is thrown
in the animation loop thread. If you pass in null or if you
never call this method, the default exception handler is used. The
default exception handler prints the stack trace to standard out
and shuts down the application.
exceptionHandler - getExceptionHandler()public static ExceptionHandler getExceptionHandler()
ExceptionHandler used when an exception is thrown
in the animation loop thread.
ExceptionHandler passed to
setExceptionHandler() or the default
ExceptionHandler if none was ever set.setExceptionHandler(ExceptionHandler)public static int getBufferWidth()
public static int getBufferHeight()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||