|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.deken.game.graphics.DisplayManager
public class DisplayManager
Title: DisplayManager
Description: This manager handles initializing and displaying to full screen graphics modes. Several DisplayModes are defined for common screen settings. They are provided as a starting point.
The refresh rate is set based on the user's current refresh rate. Since, the refresh rate can cause headache or nausea in some people, it is best not to change a user's refresh rate.
Copyright: Copyright (c) 2005
Nested Class Summary | |
---|---|
static class |
DisplayManager.ScreenSize
|
Field Summary | |
---|---|
static int |
COLOR_DEPTH_16
|
static int |
COLOR_DEPTH_32
|
static int |
COLOR_DEPTH_8
|
Constructor Summary | |
---|---|
DisplayManager(javax.swing.JFrame jFrame)
|
Method Summary | |
---|---|
java.awt.DisplayMode[] |
getCommonDisplayModes()
getCommonDisplayModes |
java.awt.DisplayMode[] |
getCompatibleDisplayModes()
getCompatibleDisplayModes |
java.awt.DisplayMode |
getCurrentDisplayMode()
getCurrentDisplayMode |
static java.awt.DisplayMode |
getDisplayMode(DisplayManager.ScreenSize screenSize,
int colorDepth)
getDisplayMode |
static java.awt.DisplayMode |
getDisplayMode(DisplayManager.ScreenSize screenSize,
int colorDepth,
int refreshRate)
|
java.awt.GraphicsDevice |
getGraphicsDevice()
|
java.awt.DisplayMode |
getPerferredCompatibleMode()
getPerferredCompatibleMode |
static void |
hideCursor(java.awt.Component component)
|
boolean |
isDisplayModeCompatible(java.awt.DisplayMode checkMode)
isDisplayModeCompatible |
void |
restoreScreen()
restoreScreen |
void |
setFullScreen(java.awt.DisplayMode displayMode)
setFullScreen |
void |
setFullScreen(java.awt.DisplayMode displayMode,
int buffering)
setFullScreen |
static void |
showCursor(boolean show,
java.awt.Component component)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int COLOR_DEPTH_16
public static final int COLOR_DEPTH_32
public static final int COLOR_DEPTH_8
Constructor Detail |
---|
public DisplayManager(javax.swing.JFrame jFrame)
jFrame
- Method Detail |
---|
public static java.awt.DisplayMode getDisplayMode(DisplayManager.ScreenSize screenSize, int colorDepth)
Taking the constants for screen size and color depth, this returns a display mode.
screenSize
- intcolorDepth
- int
public static java.awt.DisplayMode getDisplayMode(DisplayManager.ScreenSize screenSize, int colorDepth, int refreshRate)
public static void hideCursor(java.awt.Component component)
public static void showCursor(boolean show, java.awt.Component component)
public boolean isDisplayModeCompatible(java.awt.DisplayMode checkMode)
This method checks if the desired display mode is compatible.
checkMode
- DisplayMode
public void restoreScreen()
Restores the screen's display mode back to the user's settings in the desktop environment.
public java.awt.DisplayMode[] getCommonDisplayModes()
public java.awt.DisplayMode[] getCompatibleDisplayModes()
Returns a list of DisplayModes for the computer the code is running on. This is useful to allow the user to change to a DisplayMode that he can see.
public java.awt.DisplayMode getCurrentDisplayMode()
This is useful for allowing the user to see that the current setting is.
public java.awt.GraphicsDevice getGraphicsDevice()
public java.awt.DisplayMode getPerferredCompatibleMode()
This returns a valid Display Mode that is either 800x600 or 640x480, with a bitdepth of 32, 26 or 8 and a refresh rate of 60.
public void setFullScreen(java.awt.DisplayMode displayMode)
This calls setFullScreen(DisplayMode displayMode, int buffering) setting the buffer strategy to 2.
displayMode
- DisplayModepublic void setFullScreen(java.awt.DisplayMode displayMode, int buffering)
This method causes a JFrame to enter full screen mode and changes the display mode, changing the resolution, color bit depth and refresh rate. If the specified display mode is null or not compatible with this device, or if the display mode cannot be changed on this system, the current display mode is used.
This sets a user defined buffering strategy, but sets a default color of a blue background and white text with a sans serif 24 size font.
displayMode
- DisplayModebuffering
- int
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |