|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.system.DisplaySystem
public abstract class 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.
DisplaySystem ds = DisplaySystem.getDisplaySystem();
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 float |
brightness
Brightness value of display - default is 0f. |
protected float |
contrast
Contrast value of display - default is 1.0f. |
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 float |
gamma
Gamma value of display - default is 1.0f. |
protected int |
height
height selected for the renderer. |
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. |
JMECanvas |
createCanvas(int w,
int h)
createCanvas should create a canvas object with the
desired settings. |
abstract JMECanvas |
createCanvas(int w,
int h,
java.lang.String type,
java.util.HashMap<java.lang.String,java.lang.Object> props)
createCanvas should create a canvas object 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,
TextureRenderer.Target target)
Create 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. |
abstract java.lang.String |
getAdapter()
getAdapter returns the name of the underlying system's
graphics adapter for debugging / display purposes. |
int |
getBitDepth()
Returns the set bitdepth for the display system. |
float |
getBrightness()
Returns the brightness last requested by this display. |
float |
getContrast()
|
abstract RenderContext<?> |
getCurrentContext()
|
abstract java.lang.String |
getDisplayAPIVersion()
getDisplayAPIVersion returns the API version supported |
abstract java.lang.String |
getDisplayRenderer()
getDisplayRenderer returns details of the adapter |
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 java.lang.String |
getDisplayVendor()
getDisplayVendor returns the vendor of the graphics
adapter |
abstract java.lang.String |
getDriverVersion()
getDriverVersion returns a string representing the version
of driver installed on the underlying system. |
int |
getFrequency()
Returns the set frequency for the display system. |
float |
getGamma()
|
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. |
Ray |
getPickRay(Vector2f screenPosition,
boolean flipVertical,
Ray store)
Generate a pick ray from a 2d screen point. |
abstract Renderer |
getRenderer()
getRenderer returns the Renderer
implementation that is compatible with the chosen
DisplaySystem . |
Vector3f |
getScreenCoordinates(Vector3f worldPosition)
Translate world to screen coordinates |
Vector3f |
getScreenCoordinates(Vector3f worldPosition,
Vector3f store)
Translate world to screen coordinates |
static SystemProvider |
getSystemProvider()
Returns the currently system provider. |
static java.lang.String[] |
getSystemProviderIdentifiers()
Returns all available system providers |
int |
getWidth()
Returns the set width for the display system. |
Vector3f |
getWorldCoordinates(Vector2f screenPosition,
float zPos)
Translate screen to world coordinates. |
Vector3f |
getWorldCoordinates(Vector2f screenPosition,
float zPos,
Vector3f store)
Translate screen to world coordinates. |
abstract boolean |
isActive()
isActive returns true if the display is active. |
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. |
CanvasConstructor |
makeCanvasConstructor(java.lang.String type)
|
abstract void |
moveWindowTo(int locX,
int locY)
If running in windowed mode, move the window's position to the given display coordinates. |
abstract void |
recreateWindow(int w,
int h,
int bpp,
int frq,
boolean fs)
recreateWindow recreates a window with the desired
settings. |
void |
registerCanvasConstructor(java.lang.String type,
java.lang.Class<? extends CanvasConstructor> constructorClass)
|
abstract void |
reset()
reset cleans up the display system for closing or
restarting. |
static void |
resetSystemProvider()
|
void |
setBrightness(float brightness)
Note: This affects the whole screen, not just the game window. |
void |
setBrightnessGammaContrast(float brightness,
float gamma,
float contrast)
Sets all three in one call. |
void |
setContrast(float contrast)
Note: This affects the whole screen, not just the game window. |
void |
setGamma(float gamma)
Note: This affects the whole screen, not just the game window. |
void |
setHeight(int height)
Sets a new height for the display system |
abstract void |
setIcon(Image[] iconImages)
Sets one or more icons for the DisplaySystem. |
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)
setRenderer sets the Renderer object that
is to be used by this display. |
static void |
setSystemProvider(SystemProvider provider)
Sets the SystemProvider to be provider. |
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. |
void |
setWidth(int width)
Sets a new width for the display system |
protected abstract void |
updateDisplayBGC()
Update the display's gamma, brightness and contrast based on the set values. |
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
protected float gamma
protected float brightness
protected float contrast
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, the
fallback default is returned.
key
- the display system to use.
public static java.lang.String[] getSystemProviderIdentifiers()
public static SystemProvider getSystemProvider()
public static void setSystemProvider(SystemProvider provider) throws java.lang.IllegalStateException
Once installed, the provider cannot be replaced.
provider
- the SystemProvider to install. if null
, no
provider is set.
java.lang.IllegalStateException
- if a provider was previous installed.public static DisplaySystem getDisplaySystem()
public void setWidth(int width)
width
- public int getWidth()
public void setHeight(int height)
height
- public int getHeight()
public int getBitDepth()
public int getFrequency()
public boolean isFullScreen()
public abstract java.lang.String getAdapter()
getAdapter
returns the name of the underlying system's
graphics adapter for debugging / display purposes.
public abstract java.lang.String getDriverVersion()
getDriverVersion
returns a string representing the version
of driver installed on the underlying system.
public abstract java.lang.String getDisplayVendor()
getDisplayVendor
returns the vendor of the graphics
adapter
public abstract java.lang.String getDisplayRenderer()
getDisplayRenderer
returns details of the adapter
public abstract java.lang.String getDisplayAPIVersion()
getDisplayAPIVersion
returns the API version supported
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. This is dependant on OS.
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 JMECanvas createCanvas(int w, int h)
createCanvas
should create a canvas object with the
desired settings. The width and height defined by w and h define the size
of the canvas. Makes an AWT canvas by default.
w
- the width/horizontal resolution of the display.h
- the height/vertical resolution of the display.public abstract JMECanvas createCanvas(int w, int h, java.lang.String type, java.util.HashMap<java.lang.String,java.lang.Object> props)
createCanvas
should create a canvas object 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.type
- the type of canvas to make. e.g. "AWT", "SWT".props
- the properties we want to use (if any) for constructing our
canvas.public void registerCanvasConstructor(java.lang.String type, java.lang.Class<? extends CanvasConstructor> constructorClass)
public CanvasConstructor makeCanvasConstructor(java.lang.String type)
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
.Renderer
public abstract void setRenderer(Renderer r)
setRenderer
sets the Renderer
object that
is to be used by this display. The implementing class should take
measures to insure that the given Renderer is compatible with the
Display.
r
- the Renderer to set for this display.public 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 isActive()
isActive
returns true if the display is active.
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 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 float getBrightness()
public void setBrightness(float brightness)
brightness
- The brightness to set (set -1 to 1) default is 0public float getContrast()
public void setContrast(float contrast)
contrast
- The contrast to set (set greater than 0) default is 1public float getGamma()
public void setGamma(float gamma)
gamma
- The gamma to set (default is 1)public void setBrightnessGammaContrast(float brightness, float gamma, float contrast)
brightness
- gamma
- contrast
- public static void updateStates(Renderer r)
r
- The renderer to get the default states from.public abstract TextureRenderer createTextureRenderer(int width, int height, TextureRenderer.Target target)
width
- width of textureheight
- height of texturetarget
-
public Vector3f getScreenCoordinates(Vector3f worldPosition)
worldPosition
- Vector3f representing the world position to retrieve.
public Vector3f getScreenCoordinates(Vector3f worldPosition, Vector3f store)
worldPosition
- Vector3f representing the world position to retrieve.store
- Vector3f to store the world position in.
public Vector3f getWorldCoordinates(Vector2f screenPosition, float zPos)
screenPosition
- Vector2f representing the screen position with 0,0 at the
bottom left.zPos
- The z position away from the viewing plane, between 0 and 1.
public 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.
public Ray getPickRay(Vector2f screenPosition, boolean flipVertical, Ray store)
screenPosition
- Vector2f representing the screen position with 0,0 at the
bottom leftflipVertical
- Whether or not to flip the y coordinate of the screen position
across the middle of the screen.store
- The ray to store the result in. If null, a new Ray is created.
protected abstract void updateDisplayBGC()
public abstract void setIcon(Image[] iconImages)
As a reference for usual platforms on number of icons and their sizes:
Images should be in format RGBA8888. If they are not jME will try to convert them
using ImageUtils. If that fails a JmeException
could be thrown.
iconImages
- Array of Images to be used as icons.public abstract RenderContext<?> getCurrentContext()
public static void resetSystemProvider()
public abstract void moveWindowTo(int locX, int locY)
locX
- locY
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |