List of all members.
Detailed Description
The base 2D game engine. This is a singleton class which is automatically instantiated by the engine activity. It's instance can be accessed by calling Engine.instance() to retrieve the singleton instance.
Keep in mind that the settings you initialize the engine with persist throughout the life of the engine, and cannot be changed (so if you want to use sound, you must initiate the engine with the appropriate settings - see EngineActivity for more information).
- Author:
- psastras
Member Function Documentation
void psastras::engine::Engine::addUpdateHandler |
( |
UpdateHandler |
handler |
) |
[inline] |
Adds an UpdateHandler to the Engine's list of UpdateHandlers. This UpdateHandler will be paused / resumed when the Engine is paused and/or resumed.
- Parameters:
-
| handler | The UpdateHandler to add. |
void psastras::engine::Engine::applySettings |
( |
EngineSettings |
settings |
) |
[inline, protected] |
Applies the current engine settings to the engine. This should only be called once. The DrawHandler, ImageManager, and PhysicsManger, as well as other Engine instance variables are instantiated here.
- Parameters:
-
void psastras::engine::Engine::check |
( |
|
) |
[inline, protected] |
Checks the engine settings and provided handlers as well as systems specs to ensure that the engine settings are compatible with the current setup. If the settings are not compatible, errors will be output, but the engine will try to continue setup anyway - although this may result in weird behavior.
DrawHandler psastras::engine::Engine::drawHandler |
( |
|
) |
[inline] |
Returns the instance of the DrawHandler associated with the engine.
- Returns:
- The DrawHandler instance.
long psastras::engine::Engine::elapsedTime |
( |
|
) |
[inline] |
Returns the elapsed time of the engine since the last start() or paus() in milliseconds.
- Returns:
- Elapsed time in milliseconds.
BitmapManager psastras::engine::Engine::imageManager |
( |
|
) |
[inline] |
Returns the ImageManager class associated with the Engine. Note that since the ImageManager is itself a singleton class, the ImageManager can be accessed by simply calling ImageManager.instance() from any other class.
- Returns:
- The ImageManager instance.
static void psastras::engine::Engine::init |
( |
Context |
context, |
|
|
EngineSettings |
settings | |
|
) |
| | [inline, static] |
Initializes the engine by instantiating / calling the Engine's constructor. This should only be called once, since it will overwrite the previous Engine's instance (since this is a singleton class).
- Parameters:
-
| context | The main application context. |
| settings | Engine settings to instantiate the Engine with. |
static Engine psastras::engine::Engine::instance |
( |
|
) |
[inline, static] |
Returns the static instance of the Engine. You should use this method whenever you need to access any of the Engine's members (methods).
- Returns:
- Returns the singleton instance of the Engine.
boolean psastras::engine::Engine::isRunning |
( |
|
) |
[inline] |
Returns whether or not the Engine is currently running. This is false if pause() was last called, or if start() has not yet been called, and true otherwise, or if resume() / start() has been called last.
- Returns:
- Whether the Engine is currently running.
Returns the KeyboardInputHandler instance associated with the Engine. The keyboard handler is responsible for handling all ui keyboard input events fired by a Surface.
- Returns:
- The KeyboardInputHandler instance.
Returns the MessageHandler class associated with the Engine.
- Returns:
- The MessageHandler;
void psastras::engine::Engine::pause |
( |
|
) |
[inline] |
Pauses the game engine as well as all of its associated update handlers. Each update handler should be responsible for pausing itself (ex. notifications) The games running state is set to false (see isRunning_)
Returns the instance of the PhysicsHandler associated with the engine.
- Returns:
- The PhysicsHandler instance.
void psastras::engine::Engine::resume |
( |
|
) |
[inline] |
Resumes the game engine as well as all of its associated update handlers. Each update handler should be responsible for resuming itself (Ex. notifcations) The game's running state is set to true (see isRunning_), and the previous startTime_ is reset to the current system time in milliseconds.
void psastras::engine::Engine::start |
( |
|
) |
[inline] |
Starts running the engine. This method should only be called once to restart a paused engine, use resume, which will skip the engine check. If you are extending / implementing EngineActivity, you should not need to call this method.
Returns the TouchHandler instance associated with the Engine. The touch handler is responsible for handling all ui touch input events fired by a Surface.
- Returns:
- The TouchInputHandler instance.
The documentation for this class was generated from the following file:
- src/psastras/engine/Engine.java