BengScene Class Reference

#include <Scene.h>

List of all members.

Public Member Functions

 BengScene (void)
 ~BengScene (void)
 Removes the scene from the game, destroying any attached layers and any objects that might be contained in those layers.
BengSystemgetSystem (void)
 Retrieves the BengSystem object that this scene is attached to, if any.
void attachToSystem (BengSystem *parentsystem)
const char * getName (void)
void setName (const char *name)
void addLayer (BengLayer *layer)
void clearLayers (void)
 Marks all attached layers for deletion, and physically removes them after all layers have been processed, to avoid unsafe deletion.
BengLayergetLayer (int layernum)
int getNumLayers (void)
 Retrieves the total number of attached layers in this scene, minus any layers that are marked for deletion.
void setMainLayer (int mainlayer)
void setCameraPos (BengFixed xIn, BengFixed yIn)
void getCameraPos (BengVector &out)
void setCameraRegion (int xIn, int yIn, int wIn, int hIn)
void getCameraRegion (int &xOut, int &yOut, int &wOut, int &hOut)
void doCameraPons (void)
void process (void)

Friends

class BengLayer
class BengObject
class BengIGfx


Detailed Description

The BengScene class describes what is referred to as a 'scene', where all the action in a game takes place. A scene might represent a game level, a menu, a title screen, or anything else that represents a "section" of the game. A BengScene can contain BengLayer objects, and those layers can contain BengObject instances. Since you can have multiple BengScene instances at a time, you could make use of several techniques, including preloading, and virtual television screens within the scene that display what is going on in another scene.

The BengSystem object will always have one "main" scene which is handled automatically and by default will cover up the entire screen. This means you can use this to switch dynamically between different maps without inducing any loading times (although the scene will need to have been loaded previously, an operation that will take up more memory).


Constructor & Destructor Documentation

BengScene::BengScene ( void   ) 

Creates a BengScene object. It will be pretty useless in its initial state, as it initializes to nothingness. You will need to add layers and give the scene a name.

BengScene::~BengScene ( void   ) 

Removes the scene from the game, destroying any attached layers and any objects that might be contained in those layers.


Member Function Documentation

void BengScene::addLayer ( BengLayer layer  ) 

Takes an instantiated BengLayer and attaches it to the scene, adding it to the internal layers list. For the rest of the layer's lifetime, it will be managed by the scene and will rely on it for safe deletion. The basic code for attaching a layer might look like:

BengLayer *layer = new BengLayer(32, 32);
layer->setTileSize(32, 32);
scene->addLayer(layer);

void BengScene::attachToSystem ( BengSystem parentsystem  ) 

void BengScene::clearLayers ( void   ) 

Marks all attached layers for deletion, and physically removes them after all layers have been processed, to avoid unsafe deletion.

void BengScene::doCameraPons ( void   ) 

void BengScene::getCameraPos ( BengVector out  ) 

void BengScene::getCameraRegion ( int &  xOut,
int &  yOut,
int &  wOut,
int &  hOut 
)

BengLayer* BengScene::getLayer ( int  layernum  ) 

Retrieves the attached BengLayer at index layernum. Keep in mind that this method will become unreliable if at any time you decide to delete any attached layers, because the indexes of the proceeding layers will change.

const char* BengScene::getName ( void   ) 

Returns the name of this scene as previously set using setName(). The name can be seen in the standard output and logging, as well as user-defined areas such as for title cards.

int BengScene::getNumLayers ( void   ) 

Retrieves the total number of attached layers in this scene, minus any layers that are marked for deletion.

BengSystem* BengScene::getSystem ( void   ) 

Retrieves the BengSystem object that this scene is attached to, if any.

void BengScene::process ( void   ) 

void BengScene::setCameraPos ( BengFixed  xIn,
BengFixed  yIn 
)

void BengScene::setCameraRegion ( int  xIn,
int  yIn,
int  wIn,
int  hIn 
)

void BengScene::setMainLayer ( int  mainlayer  ) 

void BengScene::setName ( const char *  name  ) 

Sets the scene's name to the C string 'name'. The name can be seen in the standard output and logging, as well as user-defined areas such as for title cards.


Friends And Related Function Documentation

friend class BengIGfx [friend]

friend class BengLayer [friend]

friend class BengObject [friend]


The documentation for this class was generated from the following file:

Generated on Sun May 3 21:56:25 2009 for BlitzzEngine by  doxygen 1.5.8