GF4J 0.9.4 Beta

gameframe
Class GameFrameSettings

java.lang.Object
  |
  +--gameframe.GameFrameSettings
All Implemented Interfaces:
java.lang.Cloneable

public class GameFrameSettings
extends java.lang.Object
implements java.lang.Cloneable

This class offers the methods for a game developer to define what kind of features he wants to be enabled (fullscreen or non-fullscreen graphics modes, proprietary engines or plain Java engines etc.) the resolution of the created graphics engine.

Default values are:

Since:
GameFrame for Java 0.9
Version:
GameFrame for Java 0.9.4

Field Summary
private  int m_bpp
          The required fullscreen graphics engines bits per pixel value.
private  int m_eScreenMode
          Graphics mode for the graphics engine.
private  boolean m_fAllowJmf11
          Flag that indicates if the Java Media Framework 1.1 specific implementations of engines are allowed.
private  boolean m_fAllowMSJava
          Flag that indicates if the Microsoft Java VM specific implementations of engines are allowed.
private  boolean m_fAllowNative
          Flag that indicates if the native code implementations of engines are allowed.
private  int m_height
          The required resolutions height.
private  int m_refresh
          The required fullscreen graphics engines refresh rate.
private  java.lang.String m_requiredResolution
          The resolution that is wished from the graphics engine implementation.
private  java.lang.String m_strTitle
          The title of the window used to show the graphics engine (in component modes this is ignored).
private  int m_width
          The required resolutions width.
static int SCREENMODE_COMPONENT
          Enumerated mode for the graphics engine, means component graphics mode.
static int SCREENMODE_FULLSCREEN
          Enumerated mode for the graphics engine, means fullscreen graphics mode.
static int SCREENMODE_WINDOWED
          Enumerated mode for the graphics engine, means windowed graphics mode.
 
Constructor Summary
GameFrameSettings()
           
 
Method Summary
private  int checkBppValue(int bpp)
          Returns allways a checked and valid bits per pixel value.
 GameFrameSettings getCopy()
          Returns a copy of the settings.
 int getRequiredBitdepth()
          Returns the bits per pixel value that is required from the graphics engine implementation.
 int getRequiredRefreshRate()
          Returns the refresh rate that is required from the graphics engine implementation.
 java.lang.String getRequiredResolution()
          Returns the resolution that is required from the graphics engine implementation.
 int getRequiredResolutionHeight()
          Returns the required height of the resolution.
 int getRequiredResolutionWidth()
          Returns the required width of the resolution.
 int getScreenMode()
          Returns the flag that indicates if fullscreen modes are allowed.
 java.lang.String getTitle()
          Reutnrs the title that is shown when possible for the graphics engine.
 boolean isJmf11Allowed()
          Returns the flag that indicates if Java Media Framework 1.1 specific implementations are allowed.
 boolean isMsJavaAllowed()
          Returns the flag that indicates if Microsoft Java VM specific implementations are allowed.
 boolean isNativeAllowed()
          Returns the flag that indicates if native code implementations are allowed.
 void parseCommandLineArgs(java.lang.String[] aStrArgs)
          Parses the given command line arguments and sets the contained settings accordingly.
 void setAllowJmf11(boolean fAllow)
          Sets the flag that indicates if Java Media Framework 1.1 specific implementations are allowed.
 void setAllowMsJava(boolean fAllow)
          Sets the flag that indicates if Microsoft Java VM specific implementations are allowed.
 void setAllowNative(boolean fAllow)
          Sets the flag that indicates if native code implementations are allowed.
 void setFromApplet(java.applet.Applet applet)
          Queries the given applet for parameters and sets the contained settings accordingly.
 void setRequiredResolution(java.lang.String requiredResolution)
          Sets the resolution that is required from the graphics engine implementation.
 void setScreenMode(int eMode)
          Sets the required screen mode for the graphics engine.
 void setTitle(java.lang.String strTitle)
          Sets the title that is shown when possible for the graphics engine.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

SCREENMODE_FULLSCREEN

public static final int SCREENMODE_FULLSCREEN
Enumerated mode for the graphics engine, means fullscreen graphics mode. In fullscreen mode the GF4J takes over the whole screenspace for itself. If the implementation doesn't support fullscreen mode, the fullscreen mode is emulated (with a background window that fills the screen and a centered smalled window that is of the required size). If the implementation supports fullscreen mode, but the user asks for a mode that is not supported, the fullscreen emulation should be used.
Since:
GameFrame for Java 0.9.4

SCREENMODE_WINDOWED

public static final int SCREENMODE_WINDOWED
Enumerated mode for the graphics engine, means windowed graphics mode. In windowed mode the GF4J displays a window with title frames and all. If the implementation doesn't support windowed mode when such is required the implementation shouldn't be used.
Since:
GameFrame for Java 0.9.4

SCREENMODE_COMPONENT

public static final int SCREENMODE_COMPONENT
Enumerated mode for the graphics engine, means component graphics mode. Component mode means that the GF4J doesn't show any window by default but the user must cast the returned GraphicsEngine to a java.awt.Component and add it to a container of his own. If the implementation doesn't support component mode when such is required the implementation shouldn't be used.
Since:
GameFrame for Java 0.9.4

m_eScreenMode

private int m_eScreenMode
Graphics mode for the graphics engine. One of the SCREENMODE_xxx values.

m_fAllowMSJava

private boolean m_fAllowMSJava
Flag that indicates if the Microsoft Java VM specific implementations of engines are allowed. Defaults to true (Microsoft Java VM specific engines allowed).
Since:
GameFrame for Java 0.9

m_fAllowJmf11

private boolean m_fAllowJmf11
Flag that indicates if the Java Media Framework 1.1 specific implementations of engines are allowed. Defaults to true (JMF 1.1 engines allowed).
Since:
GameFrame for Java 0.9

m_fAllowNative

private boolean m_fAllowNative
Flag that indicates if the native code implementations of engines are allowed. Defaults to true (native engines allowed).
Since:
GameFrame for Java 0.9

m_requiredResolution

private java.lang.String m_requiredResolution
The resolution that is wished from the graphics engine implementation. Must be set before engine factory enumeration occurs (before first invocation of getRecommendedEngineFactory() or getFactories() methods) to have any effect. Defaults to "640x480" (640x480 resolution, no preferred color bit depth, no preferred refresh rate).
Since:
GameFrame for Java 0.9

m_width

private int m_width
The required resolutions width. Defaults to 640 pixels.
Since:
GameFrame for Java 0.9

m_height

private int m_height
The required resolutions height. Defaults to 480 pixels.
Since:
GameFrame for Java 0.9

m_bpp

private int m_bpp
The required fullscreen graphics engines bits per pixel value. Defaults to the value of GraphicsEngine.DEFAULT_COLOURDEPTH.
Since:
GameFrame for Java 0.9

m_refresh

private int m_refresh
The required fullscreen graphics engines refresh rate. Deafults to the value of GraphicsEngine.NO_PREFERRED_REFRESHRATE.
Since:
GameFrame for Java 0.9

m_strTitle

private java.lang.String m_strTitle
The title of the window used to show the graphics engine (in component modes this is ignored). Defaults to GraphicsEngine.DEFAULT_TITLE.
Constructor Detail

GameFrameSettings

public GameFrameSettings()
Method Detail

setRequiredResolution

public final void setRequiredResolution(java.lang.String requiredResolution)

Sets the resolution that is required from the graphics engine implementation. Must be invoked before engine factory enumeration occurs (before first invocation of getRecommendedEngineFactory() or getFactories() methods) to have any effect. Resolution is represented as string that have one of the following syntaxes (the values used are purely examplary):

Note: The bitdepth (if defined) must be one of the GameFrameSettings.COLOURDEPTH_xxBITS values, otherwise it is ignored and the default bits per pixel value (defined in GraphicsEngine.DEFAULT_COLOURDEPTH) is used.

Note: The bitdepth & refresh rate are usually ignored for non-fullscreen graphics engine implementations and the desktop's refresh rate & bitdepth are used.

Parameters:
requiredResolution - The resolution the graphics engine must support.
Since:
GameFrame for Java 0.9
See Also:
getRequiredResolution()

checkBppValue

private int checkBppValue(int bpp)
Returns allways a checked and valid bits per pixel value. If the given value is not valid it will be replaced with the default bits per pixel value (GraphicsEngine.DEFAULT_COLOURDEPTH).
Parameters:
bpp - The value to be checked for validity.
Returns:
A checked and valid bits per pixel value.

getRequiredResolution

public final java.lang.String getRequiredResolution()
Returns the resolution that is required from the graphics engine implementation.
Returns:
The resolution the wanted graphics engine must support.
Since:
GameFrame for Java 0.9
See Also:
setRequiredResolution(java.lang.String)

getRequiredBitdepth

public final int getRequiredBitdepth()
Returns the bits per pixel value that is required from the graphics engine implementation. Normally only fullscreen engine implementations can use this value, windowed graphics engine implementations usually simply ignore this value and use the current desktop BPP value. If no specific value is required returns the value of GraphicsEngine.NO_PREFERRED_BPP.
Returns:
Required fullscreen graphics engines BPP value.
Since:
GameFrame for Java 0.9
See Also:
setRequiredResolution(java.lang.String)

getRequiredRefreshRate

public final int getRequiredRefreshRate()
Returns the refresh rate that is required from the graphics engine implementation. Normally only fullscreen engine implementations can use this value, windowed graphics engine implementations usually simply ignore this value and use the current desktop BPP value. If no specific value is required returns the value of GraphicsEngine.NO_PREFERRED_REFRESHRATE.
Returns:
Required fullscreen graphics engines refresh rate.
Since:
GameFrame for Java 0.9
See Also:
setRequiredResolution(java.lang.String)

getRequiredResolutionWidth

public final int getRequiredResolutionWidth()
Returns the required width of the resolution.
Returns:
Required width.
Since:
GameFrame for Java 0.9
See Also:
setRequiredResolution(java.lang.String)

getRequiredResolutionHeight

public final int getRequiredResolutionHeight()
Returns the required height of the resolution.
Returns:
Required height.
Since:
GameFrame for Java 0.9
See Also:
setRequiredResolution(java.lang.String)

setScreenMode

public final void setScreenMode(int eMode)
Sets the required screen mode for the graphics engine. Default value is SCREENMODE_FULLSCREEN.
Parameters:
eMode - One of the SCREENMODE_xxx values.
Since:
GameFrame for Java 0.9
See Also:
getScreenMode()

getScreenMode

public final int getScreenMode()
Returns the flag that indicates if fullscreen modes are allowed.
Returns:
True if fullscreen modes are allowed.
Since:
GameFrame for Java 0.9
See Also:
setScreenMode(int)

setTitle

public void setTitle(java.lang.String strTitle)
Sets the title that is shown when possible for the graphics engine.
Parameters:
strTitle - The title that is to be shown.
Since:
GameFrame for Java 0.9.4

getTitle

public java.lang.String getTitle()
Reutnrs the title that is shown when possible for the graphics engine.
Returns:
The title that is to be shown.
Since:
GameFrame for Java 0.9.4

setAllowMsJava

public final void setAllowMsJava(boolean fAllow)
Sets the flag that indicates if Microsoft Java VM specific implementations are allowed.
Parameters:
fAllow - True if Microsoft Java VM specific libraries are allowed, false if not.
Since:
GameFrame for Java 0.9
See Also:
isMsJavaAllowed()

isMsJavaAllowed

public final boolean isMsJavaAllowed()
Returns the flag that indicates if Microsoft Java VM specific implementations are allowed.
Returns:
True if Microsoft Java VM specific libraries are allowed, false if not.
Since:
GameFrame for Java 0.9
See Also:
setAllowMsJava(boolean)

setAllowJmf11

public final void setAllowJmf11(boolean fAllow)
Sets the flag that indicates if Java Media Framework 1.1 specific implementations are allowed.
Parameters:
fAllow - True if Java Media Framework 1.1 specific implementations are allowed, false if not.
Since:
GameFrame for Java 0.9
See Also:
isJmf11Allowed()

isJmf11Allowed

public final boolean isJmf11Allowed()
Returns the flag that indicates if Java Media Framework 1.1 specific implementations are allowed.
Returns:
True if Java Media Framework 1.1 specific implementations are allowed, false if not.
Since:
GameFrame for Java 0.9
See Also:
setAllowJmf11(boolean)

setAllowNative

public final void setAllowNative(boolean fAllow)
Sets the flag that indicates if native code implementations are allowed.
Parameters:
fAllow - True if native libraries are allowed, false if not.
Since:
GameFrame for Java 0.9
See Also:
isNativeAllowed()

isNativeAllowed

public final boolean isNativeAllowed()
Returns the flag that indicates if native code implementations are allowed.
Returns:
True if native libraries are allowed, false if not.
Since:
GameFrame for Java 0.9
See Also:
setAllowNative(boolean)

setFromApplet

public final void setFromApplet(java.applet.Applet applet)

Queries the given applet for parameters and sets the contained settings accordingly. This method should be called AFTER you have set your own settings in order to allow users to override your settings. Recognizes the following Applet parameters:

Parameters:
applet - The applet queried for parameters.
Since:
GameFrame for Java 0.9.4

parseCommandLineArgs

public void parseCommandLineArgs(java.lang.String[] aStrArgs)

Parses the given command line arguments and sets the contained settings accordingly. This method should be called AFTER you have set your own settings in order to allow users to override your settings. Recognizes the following strings:

Note: The prefix can be also other than "-" as the prefix is ignored.

Parameters:
aStrArgs - Array of command line arguments.
Since:
GameFrame for Java 0.9

getCopy

public GameFrameSettings getCopy()
Returns a copy of the settings.
Returns:
A copy of the settings.
Since:
GameFrame for Java 0.9

GF4J 0.9.4 Beta