|
GF4J 0.9.4 Beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gameframe.GameFrame
The GameFrame librarys main entry point class. The methods in this class are mainly used when the game is starting, after that this class is normally not used at all. For this reason many of the methods in this class aren't optimized for speed, but for lesser memory usage. Only exception is the getGameFramePath() method that might be used by implementations to find out e.g. the location of the default font bitmap. This one method is made to be as fast as possible.
Field Summary | |
static int |
BUILD_NUMBER
The build number of this library. |
static java.lang.Class |
ENGINE_FACTORY_CLASS
The engine factory class (used when finding engine factories). |
static java.lang.String |
ENGINE_FACTORY_GET_INSTANCE_METHOD_NAME
The engine factory's get instance method name. |
static java.lang.Class[] |
ENGINE_FACTORY_GET_INSTANCE_METHOD_PARAM_CLASSES
The engine factory's get instance methods parameter classes. |
static java.lang.String |
ENGINE_FACTORY_IS_RUNNABLE_METHOD_NAME
The engine factory's is runnable on current platform method name. |
static java.lang.String |
ENGINE_MAIN_PACKAGE_NAME
The package name of the main package for engines. |
static java.lang.String |
ENGINE_SUBDIR_NAME
The subdirectory name of the directory for engines. |
static java.lang.String |
GAME_FRAME_PACKAGE_NAME
The package name of the main package for engines. |
static boolean |
IS_STABLE_RELEASE
Is this release a stable release. |
protected EngineFactory |
m_currentEngineFactory
The current engine factory or null if not searched. |
protected java.util.Vector |
m_engineFactories
Vector of the engine factories that are found. |
protected boolean |
m_fGameFrameMainDirectorySearched
Flag that indicates if the path to the GameFrame classes has been searched at least once. |
protected GameFrameSettings |
m_settings
The settings that are used to find the engine factory. |
protected java.lang.String |
m_strGameFrameMainDirectory
The main directory of GameFrame library. |
static int |
MAJOR_VERSION
The major version number of this library. |
static int |
MINOR_VERSION
The minor version number of this library. |
protected static GraphicsEngine |
mStatic_graphicsEngine
The recommended graphics engine. |
protected static InputEngine |
mStatic_inputEngine
The recommended input engine. |
protected static GameFrame |
mStatic_singletonInstance
The singleton instance of GameFrame class. |
protected static SoundEngine |
mStatic_soundEngine
The recommended sound engine. |
Constructor Summary | |
|
GameFrame()
Constructs the GameFrame using default settings. |
protected |
GameFrame(boolean fDoNotInitialize)
For use by subclasses that don't want to initialize the GameFrame in this classes constructors, but want to call the initFromSettings() by themselves when they are ready. |
|
GameFrame(GameFrameSettings settings)
Constructs the GameFrame using the given settings. |
Method Summary | |
protected void |
addEngineFactoryClasses(java.util.Vector engineFactoryClasses)
Tries to instantiate the given EngineFactory classes by invoking their static "getInstance(GameFrameSettings)" methods. |
protected void |
addFactory(EngineFactory factory)
Adds the given factory instance to the list of factories if the given factory is runnable on this platform. |
static Timer |
createTimer()
Returns a new timer instance. |
static void |
exit(int iValue)
Exits cleanly from application that has used GameFrame by first finalizing the whole library (that ensures all native resources are freed) and then calling carbage collector and waiting for a while and THEN exiting the application just like System.exit() method. |
void |
finalize()
Finalizes this GameFrame instance and finalizes the whole GameFrame library. |
protected java.util.Vector |
findClassesInSubdirectoriesThatImplementInterface(java.lang.String strParentDirectoryName,
java.util.Vector subDirectories,
java.lang.Class targetInterface)
Finds the classes that implement the given interface and that reside in one of the subdirectories in the given list of directories. |
protected java.util.Vector |
findSubdirectories(java.lang.String strDirectory)
Finds the subdirectories under the given directory name. |
static int |
getBuild()
Returns the build number of the GameFrame library. |
java.lang.String |
getDefaultFontBitmapFilename()
Filename that can be used to load the default font bitmap. |
java.awt.Image |
getDefaultIcon()
Returns the Image that is set as the default image icon for all graphics engine windows. |
static java.lang.String |
getDescription()
Returns the (possibly multiline) description of the currently used implementation. |
java.lang.String |
getGameFramePath()
Returns the absolute path to the main directory of the library that contains the GameFrame public classes. |
static GraphicsEngine |
getGraphicsEngine()
Returns the recommended graphics engine for the current platform or null if graphics engine was for some reason not created. |
static InputEngine |
getInputEngine()
Returns the recommended input engine for the current platform or null if input engine was for some reason not created. |
static GameFrame |
getInstance()
Returns the singleton instance of the GameFrame class. |
static int |
getMajorVersion()
Returns the major version of the GameFrame library. |
static int |
getMinorVersion()
Returns the minor version of the GameFrame library. |
static java.lang.String |
getName()
Returns the short name (max 8 characters) of the currently used implementation e.g. |
protected EngineFactory |
getRecommendedEngineFactory()
Upon invocation decides which of the engine factory implementations meets the set requirements and suits the current platform the best and returns it. |
static SoundEngine |
getSoundEngine()
Returns the recommended sound engine for the current platform or null if sound engine was for some reason not created. |
static int |
getSuitabilityForPlatform()
Returns the suitability of the currently used implementation for the current platform as one of the enumerated EngineFactory.SUITABILITY_xxx values. |
static java.lang.String[] |
getSupportedResolutions()
Returns all the fullscreen graphics modes supported by recommended graphics engine. |
protected void |
initEngines()
Initializes the recommended engines for the current platform, so that when any of the static getXXXXEngine() methods are called no exceptions are thrown. |
protected void |
initFromSettings(GameFrameSettings settings)
Initializes the library instance from the given settings object. |
static boolean |
isInitialized()
Returns whether GF4J library is initialized at the moment or not. |
static boolean |
isStableVersion()
Returns true if this version is a stable release (not prerelease, beta or alpha or anything like that) meant for anyones use. |
protected void |
searchEngineFactories()
Does the core job of adding all engine factories to the list of runnable factories (engine factories that can run on the current platform). |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int MAJOR_VERSION
public static final int MINOR_VERSION
public static final int BUILD_NUMBER
public static final boolean IS_STABLE_RELEASE
public static final java.lang.String GAME_FRAME_PACKAGE_NAME
public static final java.lang.String ENGINE_MAIN_PACKAGE_NAME
public static final java.lang.String ENGINE_SUBDIR_NAME
public static final java.lang.Class ENGINE_FACTORY_CLASS
public static final java.lang.String ENGINE_FACTORY_GET_INSTANCE_METHOD_NAME
public static final java.lang.String ENGINE_FACTORY_IS_RUNNABLE_METHOD_NAME
public static final java.lang.Class[] ENGINE_FACTORY_GET_INSTANCE_METHOD_PARAM_CLASSES
protected static GameFrame mStatic_singletonInstance
protected java.lang.String m_strGameFrameMainDirectory
protected boolean m_fGameFrameMainDirectorySearched
protected GameFrameSettings m_settings
protected EngineFactory m_currentEngineFactory
protected java.util.Vector m_engineFactories
protected static GraphicsEngine mStatic_graphicsEngine
protected static SoundEngine mStatic_soundEngine
protected static InputEngine mStatic_inputEngine
Constructor Detail |
public GameFrame() throws SettingsException, GameFrameException
SettingsException
- Thrown if a GameFrame instance allready exists.
GameFrame instance can be destroyed by calling the finalize() method.GameFrameException
- Thrown if some engine fails to initialize.GameFrameSettings
public GameFrame(GameFrameSettings settings) throws SettingsException, GameFrameException
settings
- The settings to use inside the GameFrame library. If null is provided uses
default settings.SettingsException
- Thrown if a GameFrame instance allready exists.
GameFrame instance can be destroyed by calling the finalize() method.GameFrameException
- Thrown if some engine fails to initialize.GameFrameSettings
protected GameFrame(boolean fDoNotInitialize)
fDoNotInitialize
- Ignored...Method Detail |
public static boolean isInitialized()
public static GameFrame getInstance()
NullPointerException
- Thrown if GameFrame has not been created.protected void initFromSettings(GameFrameSettings settings) throws SettingsException, GameFrameException
settings
- The settings to use inside the GameFrame library. If null is provided uses
default settings.SettingsException
- Thrown if a GameFrame instance allready exists.
GameFrame instance can be destroyed by calling the finalize() method.GameFrameException
- Thrown if some engine fails to initialize.GameFrameSettings
protected void initEngines() throws GameFrameException
GameFrameException
- Thrown if some engine fails to initialize.GameFrameSettings
protected EngineFactory getRecommendedEngineFactory()
public java.lang.String getGameFramePath()
public java.awt.Image getDefaultIcon()
public java.lang.String getDefaultFontBitmapFilename()
protected void searchEngineFactories()
Does the core job of adding all engine factories to the list of runnable factories (engine factories that can run on the current platform). Later added engine factories that have the same suitability value will override engine factories that were added earlier.
Note to engine implementors: Engine implementors that add new engines must add their engine factories in this method. Also this is the method to override if you want to make your own custom GameFrame subclass.
protected java.util.Vector findSubdirectories(java.lang.String strDirectory)
The
- directory whose subdirectories are searched.protected java.util.Vector findClassesInSubdirectoriesThatImplementInterface(java.lang.String strParentDirectoryName, java.util.Vector subDirectories, java.lang.Class targetInterface)
strParentDirectoryName
- The name of the parent directory (used as the main package name).subDirectories
- The subdirectories that are searched through.targetInterface
- The interface whose implementors are to be searched.protected void addEngineFactoryClasses(java.util.Vector engineFactoryClasses)
engineFactoryClasses
- The EngineFactory classes to be instantiated and added.protected void addFactory(EngineFactory factory)
factory
- The engine factory to be added to list of factories.public static boolean isStableVersion()
public static int getMajorVersion()
public static int getMinorVersion()
public static int getBuild()
public static java.lang.String getName()
public static java.lang.String getDescription()
public static int getSuitabilityForPlatform()
public static GraphicsEngine getGraphicsEngine()
public static InputEngine getInputEngine()
public static SoundEngine getSoundEngine()
public static java.lang.String[] getSupportedResolutions()
public static Timer createTimer() throws GameFrameException
GameFrameException
- Thrown if timer creation fails.public static void exit(int iValue)
iValue
- The integer value to be returned by the exit method
to the native system.public void finalize()
finalize
in class java.lang.Object
|
GF4J 0.9.4 Beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |