|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jme.system.DisplaySystem
DisplaySystem defines an interface for system creation.
Specifically, any implementing class will create a window for rendering. It
also should create the appropriate Renderer object that allows
the client to render to this window.
Implmenting classes should check for the appropriate libraries to insure
these libraries are indeed installed on the system. This will allow users to
cleanly exit if an improper library was chosen for rendering.
Example usage:
DisplaySystem ds = DisplaySystem.getDisplaySystem("LWJGL");
ds.createWindow(640,480,32,60,true);
Renderer r = ds.getRenderer();
Renderer| Field Summary | |
protected int |
alphaBits
Alpha bits to use for the renderer. |
protected int |
bpp
Bit depth selected for renderer. |
protected boolean |
created
Is the display created already? |
protected int |
depthBits
Depth bits to use for the renderer. |
protected int |
frq
Frequency selected for renderer. |
protected boolean |
fs
Is the display full screen? |
protected int |
height
height selected for the renderer. |
static java.lang.String[] |
rendererNames
The list of current implemented rendering APIs that subclass Display. |
protected int |
samples
Number of samples to use for the multisample buffer. |
protected int |
stencilBits
Stencil bits to use for the renderer. |
protected int |
width
Width selected for the renderer. |
| Constructor Summary | |
protected |
DisplaySystem()
A new display system has been created. |
| Method Summary | |
abstract void |
close()
close shutdowns and destroys any window contexts. |
abstract java.awt.Canvas |
createCanvas(int w,
int h)
createCanvas creates an awt canvas with the
desired settings. |
abstract void |
createHeadlessWindow(int w,
int h,
int bpp)
createHeadlessWindow creates a headless window with the
desired settings. |
abstract TextureRenderer |
createTextureRenderer(int width,
int height,
boolean useRGB,
boolean useRGBA,
boolean useDepth,
boolean isRectangle,
int target,
int mipmaps)
Crate a TextureRenderer using the underlying system. |
abstract void |
createWindow(int w,
int h,
int bpp,
int frq,
boolean fs)
createWindow creates a window with the desired settings. |
int |
getBitDepth()
Returns the set bitdepth for the display system. |
static DisplaySystem |
getDisplaySystem()
Returns the currently created display system. |
static DisplaySystem |
getDisplaySystem(java.lang.String key)
getDisplaySystem is a factory method that creates the
appropriate display system specified by the key parameter. |
abstract WidgetFont |
getFont(java.lang.String fontName)
|
int |
getFrequency()
Returns the set frequency for the display system. |
int |
getHeight()
Returns the set height for the display system. |
int |
getMinAlphaBits()
Returns the minimum bits per pixel in the alpha buffer. |
int |
getMinDepthBits()
Returns the minimum bits per pixel in the depth buffer. |
int |
getMinSamples()
Returns the minimum samples in multisample buffer. |
int |
getMinStencilBits()
Returns the minimum bits per pixel in the stencil buffer. |
abstract Renderer |
getRenderer()
getRenderer returns the Renderer
implementation that is compatible with the chosen
DisplaySystem. |
abstract RendererType |
getRendererType()
getRendererType returns an instance of a strongly typed
enumeration that can be used to determine the renderer that the
DisplaySystem is currently using. |
abstract Vector3f |
getScreenCoordinates(Vector3f worldPosition)
Translate world to screen coordinates |
abstract Vector3f |
getScreenCoordinates(Vector3f worldPosition,
Vector3f store)
Translate world to screen coordinates |
int |
getWidth()
Returns the set width for the display system. |
abstract Vector3f |
getWorldCoordinates(Vector2f screenPosition,
float zPos)
Translate screen to world coordinates. |
abstract Vector3f |
getWorldCoordinates(Vector2f screenPosition,
float zPos,
Vector3f store)
Translate screen to world coordinates. |
abstract boolean |
isClosing()
isClosing notifies if the window is currently closing. |
boolean |
isCreated()
isCreated returns the current status of the display
system. |
boolean |
isFullScreen()
Returns whether or not the display system is set to be full screen. |
abstract boolean |
isValidDisplayMode(int width,
int height,
int bpp,
int freq)
isValidDisplayMode determines if the given parameters
constitute a valid display mode on this system. |
abstract void |
recreateWindow(int w,
int h,
int bpp,
int frq,
boolean fs)
recreateWindow recreates a window with the desired
settings. |
abstract void |
reset()
reset cleans up the display system for closing or
restarting. |
void |
setMinAlphaBits(int alphaBits)
Sets the minimum bits per pixel in the alpha buffer. |
void |
setMinDepthBits(int depthBits)
Sets the minimum bits per pixel in the depth buffer. |
void |
setMinSamples(int samples)
Sets the minimum samples in the multisample buffer. |
void |
setMinStencilBits(int stencilBits)
Sets the minimum bits per pixel in the stencil buffer. |
abstract void |
setRenderer(Renderer r)
|
abstract void |
setTitle(java.lang.String title)
Sets the title of the display system. |
abstract void |
setVSyncEnabled(boolean enabled)
setVSyncEnabled attempts to enable or disable monitor
vertical synchronization. |
static void |
updateStates(Renderer r)
Called when the display system is created, this function sets the default render states for the renderer. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected int width
protected int height
protected int bpp
protected int frq
protected boolean fs
protected boolean created
protected int alphaBits
protected int depthBits
protected int stencilBits
protected int samples
public static final java.lang.String[] rendererNames
| Constructor Detail |
protected DisplaySystem()
| Method Detail |
public static DisplaySystem getDisplaySystem(java.lang.String key)
getDisplaySystem is a factory method that creates the
appropriate display system specified by the key parameter. If the key
given is not a valid identifier for a specific display system, null is
returned. For valid display systems see the rendererNames
array.
key - the display system to use.
public static DisplaySystem getDisplaySystem()
public int getWidth()
public int getHeight()
public int getBitDepth()
public int getFrequency()
public boolean isFullScreen()
public abstract boolean isValidDisplayMode(int width,
int height,
int bpp,
int freq)
isValidDisplayMode determines if the given parameters
constitute a valid display mode on this system. Returning true does not
necessarily guarantee that the system is capable of running in the
specified display mode, merely that it believes it is possible.
width - the width/horizontal resolution of the display.height - the height/vertical resolution of the display.bpp - the bit depth of the display.freq - the frequency of refresh of the display (in Hz).public abstract void setVSyncEnabled(boolean enabled)
setVSyncEnabled attempts to enable or disable monitor
vertical synchronization. The method is a "best attempt" to change the
monitor vertical refresh synchronization, and is not guaranteed
to be successful.
enabled - true to synchronize, false to
ignore synchronizationpublic abstract void setTitle(java.lang.String title)
title - The new display title.
public abstract void createWindow(int w,
int h,
int bpp,
int frq,
boolean fs)
createWindow creates a window with the desired settings.
The width and height defined by w and h define the size of the window if
fullscreen is false, otherwise it defines the resolution of the
fullscreen display. The color depth is defined by bpp. The implementing
class should only allow 16, 24, and 32. The monitor frequency is defined
by the frq parameter and should not exceed the capabilities of the
connected hardware, the implementing class should attempt to assure this
does not happen. Lastly, the boolean flag fs determines if the display
should be windowed or fullscreen. If false, windowed is chosen. This
window will be placed in the center of the screen initially. If true
fullscreen mode will be entered with the appropriate settings.
w - the width/horizontal resolution of the display.h - the height/vertical resolution of the display.bpp - the color depth of the display.frq - the frequency of refresh of the display.fs - flag determining if fullscreen is to be used or not. True will
use fullscreen, false will use windowed mode.
public abstract void createHeadlessWindow(int w,
int h,
int bpp)
createHeadlessWindow creates a headless window with the
desired settings. A headless window is a rendering target that is not
shown on screen. It is useful for doing offline rendering, integration
and so forth. You can not have a regular and headless
window at the same time. The width and height defined by w and h define
the size of the window. The color depth is defined by bpp.
w - the width/horizontal resolution of the display.h - the height/vertical resolution of the display.bpp - the color depth of the display.
public abstract java.awt.Canvas createCanvas(int w,
int h)
createCanvas creates an awt canvas with the
desired settings. The width and height defined by w and h define
the size of the canvas.
w - the width/horizontal resolution of the display.h - the height/vertical resolution of the display.
public abstract void recreateWindow(int w,
int h,
int bpp,
int frq,
boolean fs)
recreateWindow recreates a window with the desired
settings.
w - the width/horizontal resolution of the display.h - the height/vertical resolution of the display.bpp - the color depth of the display.frq - the frequency of refresh of the display.fs - flag determining if fullscreen is to be used or not. True will
use fullscreen, false will use windowed mode.public abstract Renderer getRenderer()
getRenderer returns the Renderer
implementation that is compatible with the chosen
DisplaySystem. For example, if
LWJGLDisplaySystem is used, the returned
Renderer will be LWJGLRenderer.
Renderer implementation that is
compatible with the used DisplaySystem.Rendererpublic abstract void setRenderer(Renderer r)
public abstract RendererType getRendererType()
getRendererType returns an instance of a strongly typed
enumeration that can be used to determine the renderer that the
DisplaySystem is currently using.
JmeTypepublic boolean isCreated()
isCreated returns the current status of the display
system. If the window and renderer are created, true is returned,
otherwise false.
public abstract boolean isClosing()
isClosing notifies if the window is currently closing.
This could be caused via the application itself or external interrupts
such as alt-f4 etc.
public abstract void reset()
reset cleans up the display system for closing or
restarting.
public abstract void close()
close shutdowns and destroys any window contexts.
public abstract WidgetFont getFont(java.lang.String fontName)
fontName - -
name of the font to loaded
public int getMinAlphaBits()
public void setMinAlphaBits(int alphaBits)
alphaBits - -
the new value for alphaBitspublic int getMinDepthBits()
public void setMinDepthBits(int depthBits)
depthBits - -
the new value for depthBitspublic int getMinStencilBits()
public void setMinStencilBits(int stencilBits)
stencilBits - -
the new value for stencilBitspublic int getMinSamples()
public void setMinSamples(int samples)
samples - -
the new value for samplespublic static void updateStates(Renderer r)
r - The renderer to get the default states from.
public abstract TextureRenderer createTextureRenderer(int width,
int height,
boolean useRGB,
boolean useRGBA,
boolean useDepth,
boolean isRectangle,
int target,
int mipmaps)
width - width of textureheight - height of textureuseRGB - if this is true, useRGBA should not beuseRGBA - if this is true, useRGB should not beuseDepth - isRectangle - target - mipmaps -
public abstract Vector3f getScreenCoordinates(Vector3f worldPosition)
worldPosition - Vector3f representing the world position to retrieve.
public abstract Vector3f getScreenCoordinates(Vector3f worldPosition,
Vector3f store)
worldPosition - Vector3f representing the world position to retrieve.store - Vector3f to store the world position in.
public abstract Vector3f getWorldCoordinates(Vector2f screenPosition,
float zPos)
screenPosition - Vector2f representing the screen position with 0,0 at the
bottom left.zPos - float The z position away from the viewing plane.
public abstract Vector3f getWorldCoordinates(Vector2f screenPosition,
float zPos,
Vector3f store)
screenPosition - Vector2f representing the screen position with 0,0 at the
bottom leftzPos - float The z position away from the viewing plane.store - Vector3f The vector to store the result in.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||