Level Class Reference

This class holds the complete level. More...

#include <Level.h>

Inherits GLInterface.

Inheritance diagram for Level:

Inheritance graph
[legend]
Collaboration diagram for Level:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Level (Window *p_window)
 Standard constructor.
virtual ~Level ()
 Standard destructor.
int load (std::string p_filename)
 Loads the level from file.
int init ()
 Initializes OpenGL subsystem.
int run ()
 Starts the gamelogic.
int compute ()
 Does all necessary computationbs on the objects/units.
bool setVisible (unsigned int p_x, unsigned int p_y)
 Sets the field at the given position to visible.
int computeVisibility ()
 Computes, wich fields are visible.
int renderScene (bool p_normal=true)
 Renders the Level.
int renderInterface ()
 Renders the Interface.
int initViewCamera (bool resetMatrix=true)
 Positions the camera and so on.
int initViewInterface (bool resetMatrix=true)
 Positions the camera and so on for the interface.
int pick ()
 Selects the Object that has been clicked on.
bool checkInput ()
 Checks the input.
int createWindow (int p_width, int p_height, bool p_fullscreen=false)
 Creates a window.
virtual int initGL ()
 Initializes OpenGL.
int setViewportCamera ()
 Sets the render region to the window size.
int setViewportInterface ()
 Sets the render region to the lower bound centered rectangle described by Level::interfaceSizeWidth and Level::interfaceSizeHeight.

Public Attributes

std::vector< std::vector<
Field * > > 
grid
 Holds the grid of Fields.
std::map< std::string, Player * > players
 Holds the players assoziatet by it's color.
InterfaceplayerInterface
 Holds the Instance of the Interface.
std::map< std::string, std::string > bindings
 Holds the key bindings.
FunctionMap functions
 Holds the functions.
std::list< std::string > currentCommands
 Holds the actions to perform each round (game-tick).
std::list< std::string > singleCommands
 Holds the actions to perform once.
Vector3d position
 Holds the view/camera Position.
Vector3i mousePos
 Holds the mouseposition of the last round.
long round
 counter for the current round.
std::list< Texture * > effects
 Holds all direct absorbation effects.
CyclicList< std::list< EventInterface * > > eventList
 Holds all Events.
Networknetwork
 Holds the pointer to the network class.

Static Public Attributes

static const unsigned int roundTime = 20
 Holds constant time a game tick will take.
static const int interfaceSizeWidth = 500
 Holds the width of the interface in absolute pixel.
static const int interfaceSizeHeight = 150
 Holds the height of the interface in absolute pixel.

Detailed Description

This class holds the complete level.

Definition at line 41 of file Level.h.


Constructor & Destructor Documentation

Level::Level ( Window p_window  ) 

Standard constructor.

Parameters:
p_window Instance of the window to display in

Definition at line 42 of file Level.cpp.

References bindings, functions, FunctionHandler::grabScreen(), network, playerInterface, FunctionHandler::quit(), FunctionHandler::releaseScreen(), FunctionHandler::scroll(), FunctionHandler::scrollDown(), FunctionHandler::scrollLeft(), FunctionHandler::scrollRight(), FunctionHandler::scrollUp(), FunctionHandler::select(), FunctionHandler::selectBonus(), FunctionHandler::setSpawnDestination(), FunctionHandler::settle(), FunctionHandler::standardAction(), FunctionHandler::zoomIn(), and FunctionHandler::zoomOut().

Here is the call graph for this function:

Level::~Level (  )  [virtual]

Standard destructor.

Definition at line 79 of file Level.cpp.

References playerInterface.


Member Function Documentation

int Level::load ( std::string  p_filename  ) 

Loads the level from file.

Parameters:
p_filename The file from which to load.
Returns:
The number of Objects loaded.

Definition at line 409 of file Level.cpp.

References grid, initGL(), Interface::load(), Texture::loadAndBind(), playerInterface, players, Field::shadowTexture, and splitLine().

Referenced by WinMain().

Here is the call graph for this function:

int Level::init (  ) 

Initializes OpenGL subsystem.

Returns:
0 for success.

Definition at line 488 of file Level.cpp.

References grid, and position.

Referenced by WinMain().

int Level::run (  ) 

Starts the gamelogic.

Here runs the complete game.

Returns:
0 for success.

Definition at line 85 of file Level.cpp.

References checkInput(), computeVisibility(), eventList, initViewCamera(), initViewInterface(), CyclicList< T >::moveOn(), renderInterface(), renderScene(), round, roundTime, setViewportCamera(), setViewportInterface(), sleep(), Window::swapBuffers(), and GLInterface::window.

Referenced by WinMain().

Here is the call graph for this function:

int Level::compute (  ) 

Does all necessary computationbs on the objects/units.

Returns:
0 for success.

Definition at line 161 of file Level.cpp.

References grid.

bool Level::setVisible ( unsigned int  p_x,
unsigned int  p_y 
)

Sets the field at the given position to visible.

Parameters:
p_x x-coord of the Field.
p_y y-coord of the Field.
Returns:
true for success

Definition at line 350 of file Level.cpp.

References grid.

Referenced by computeVisibility().

int Level::computeVisibility (  ) 

Computes, wich fields are visible.

Returns:
0 for success.

Definition at line 359 of file Level.cpp.

References grid, and setVisible().

Referenced by run().

Here is the call graph for this function:

int Level::renderScene ( bool  p_normal = true  ) 

Renders the Level.

Returns:
0 for success.

Definition at line 230 of file Level.cpp.

References effects, grid, Vector3d::x, and Vector3d::y.

Referenced by pick(), and run().

int Level::renderInterface (  ) 

Renders the Interface.

Returns:
0 for success.

Definition at line 278 of file Level.cpp.

References playerInterface, and Interface::render().

Referenced by pick(), and run().

Here is the call graph for this function:

int Level::initViewCamera ( bool  resetMatrix = true  ) 

Positions the camera and so on.

Returns:
0 for success.

Definition at line 181 of file Level.cpp.

References Window::height, position, Window::width, GLInterface::window, Vector3d::x, Vector3d::y, and Vector3d::z.

Referenced by pick(), and run().

int Level::initViewInterface ( bool  resetMatrix = true  ) 

Positions the camera and so on for the interface.

Returns:
0 for success.

Definition at line 205 of file Level.cpp.

References interfaceSizeHeight, and interfaceSizeWidth.

Referenced by pick(), and run().

int Level::pick (  ) 

Selects the Object that has been clicked on.

Returns:
the id of the selectedField

Definition at line 525 of file Level.cpp.

References initViewCamera(), initViewInterface(), interfaceSizeHeight, interfaceSizeWidth, Window::mousePos, renderInterface(), renderScene(), setViewportCamera(), setViewportInterface(), Window::width, GLInterface::window, Vector3i::x, and Vector3i::y.

Referenced by FunctionHandler::select(), FunctionHandler::selectBonus(), FunctionHandler::setSpawnDestination(), and FunctionHandler::standardAction().

Here is the call graph for this function:

bool Level::checkInput (  ) 

Checks the input.

Returns:
False for ExitGame.

Definition at line 287 of file Level.cpp.

References bindings, Window::checkMessages(), currentCommands, functions, GLInterface::inputMessages, singleCommands, and GLInterface::window.

Referenced by run().

Here is the call graph for this function:

int Level::createWindow ( int  p_width,
int  p_height,
bool  p_fullscreen = false 
)

Creates a window.

Parameters:
p_width The width of the window.
p_height The height of the window.
p_fullscreen Fullscreen flag.
Returns:
0 for success.

int Level::initGL (  )  [virtual]

Initializes OpenGL.

Returns:
0 for success.

Reimplemented from GLInterface.

Definition at line 516 of file Level.cpp.

References GLInterface::initGL().

Referenced by load().

Here is the call graph for this function:

int Level::setViewportCamera (  ) 

Sets the render region to the window size.

Returns:
0 for success.

Definition at line 613 of file Level.cpp.

References Window::height, Window::width, and GLInterface::window.

Referenced by pick(), and run().

int Level::setViewportInterface (  ) 

Sets the render region to the lower bound centered rectangle described by Level::interfaceSizeWidth and Level::interfaceSizeHeight.

Returns:
0 for success.

Definition at line 622 of file Level.cpp.

References interfaceSizeHeight, interfaceSizeWidth, Window::width, and GLInterface::window.

Referenced by pick(), and run().


Member Data Documentation

std::vector< std::vector<Field*> > Level::grid

Holds the grid of Fields.

Definition at line 146 of file Level.h.

Referenced by compute(), computeVisibility(), init(), load(), renderScene(), and setVisible().

std::map<std::string, Player*> Level::players

Holds the players assoziatet by it's color.

Definition at line 151 of file Level.h.

Referenced by load(), and Interface::render().

Interface* Level::playerInterface

Holds the Instance of the Interface.

Definition at line 156 of file Level.h.

Referenced by Level(), load(), renderInterface(), and ~Level().

std::map<std::string, std::string> Level::bindings

Holds the key bindings.

Definition at line 161 of file Level.h.

Referenced by checkInput(), FunctionHandler::grabScreen(), Level(), Unit::mutate(), FunctionHandler::releaseScreen(), FunctionHandler::select(), and FunctionHandler::settle().

FunctionMap Level::functions

Holds the functions.

Definition at line 166 of file Level.h.

Referenced by checkInput(), and Level().

std::list<std::string> Level::currentCommands

Holds the actions to perform each round (game-tick).

Definition at line 171 of file Level.h.

Referenced by checkInput(), FunctionHandler::grabScreen(), and FunctionHandler::releaseScreen().

std::list<std::string> Level::singleCommands

Holds the actions to perform once.

Definition at line 176 of file Level.h.

Referenced by checkInput().

Vector3d Level::position

Holds the view/camera Position.

Definition at line 213 of file Level.h.

Referenced by init(), initViewCamera(), FunctionHandler::scroll(), FunctionHandler::scrollDown(), FunctionHandler::scrollLeft(), FunctionHandler::scrollRight(), FunctionHandler::scrollUp(), FunctionHandler::zoomIn(), and FunctionHandler::zoomOut().

Vector3i Level::mousePos

Holds the mouseposition of the last round.

Definition at line 218 of file Level.h.

Referenced by FunctionHandler::grabScreen(), and FunctionHandler::scroll().

long Level::round

counter for the current round.

Definition at line 223 of file Level.h.

Referenced by run().

std::list<Texture*> Level::effects

Holds all direct absorbation effects.

Definition at line 228 of file Level.h.

Referenced by EventDeleteEffect::compute(), renderScene(), and FunctionHandler::standardAction().

CyclicList< std::list< EventInterface* > > Level::eventList

Holds all Events.

Definition at line 233 of file Level.h.

Referenced by Unit::compute(), Unit::generate(), run(), FunctionHandler::setSpawnDestination(), Unit::settle(), FunctionHandler::settle(), and FunctionHandler::standardAction().

Network* Level::network

Holds the pointer to the network class.

Definition at line 238 of file Level.h.

Referenced by Level(), and WinMain().

const unsigned int Level::roundTime = 20 [static]

Holds constant time a game tick will take.

Definition at line 243 of file Level.h.

Referenced by Unit::load(), and run().

const int Level::interfaceSizeWidth = 500 [static]

Holds the width of the interface in absolute pixel.

Definition at line 248 of file Level.h.

Referenced by initViewInterface(), pick(), and setViewportInterface().

const int Level::interfaceSizeHeight = 150 [static]

Holds the height of the interface in absolute pixel.

Definition at line 253 of file Level.h.

Referenced by initViewInterface(), pick(), and setViewportInterface().


The documentation for this class was generated from the following files:
Generated on Tue Jul 17 22:02:23 2007 for C0re by  doxygen 1.5.2