#include <Level.h>
Inherits GLInterface.
Inheritance diagram for Level:
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. | |
Interface * | playerInterface |
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. | |
Network * | network |
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. |
Definition at line 41 of file Level.h.
Level::Level | ( | Window * | p_window | ) |
Standard constructor.
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] |
int Level::load | ( | std::string | p_filename | ) |
Loads the level from file.
p_filename | The file from which to load. |
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 | ( | ) |
int Level::run | ( | ) |
Starts the gamelogic.
Here runs the complete game.
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 | ( | ) |
bool Level::setVisible | ( | unsigned int | p_x, | |
unsigned int | p_y | |||
) |
int Level::computeVisibility | ( | ) |
Computes, wich fields are visible.
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.
Definition at line 230 of file Level.cpp.
References effects, grid, Vector3d::x, and Vector3d::y.
int Level::renderInterface | ( | ) |
Renders the Interface.
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.
Definition at line 181 of file Level.cpp.
References Window::height, position, Window::width, GLInterface::window, Vector3d::x, Vector3d::y, and Vector3d::z.
int Level::initViewInterface | ( | bool | resetMatrix = true |
) |
Positions the camera and so on for the interface.
Definition at line 205 of file Level.cpp.
References interfaceSizeHeight, and interfaceSizeWidth.
int Level::pick | ( | ) |
Selects the Object that has been clicked on.
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.
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.
p_width | The width of the window. | |
p_height | The height of the window. | |
p_fullscreen | Fullscreen flag. |
int Level::initGL | ( | ) | [virtual] |
Initializes OpenGL.
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.
Definition at line 613 of file Level.cpp.
References Window::height, Window::width, and GLInterface::window.
int Level::setViewportInterface | ( | ) |
Sets the render region to the lower bound centered rectangle described by Level::interfaceSizeWidth and Level::interfaceSizeHeight.
Definition at line 622 of file Level.cpp.
References interfaceSizeHeight, interfaceSizeWidth, Window::width, and GLInterface::window.
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().
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().
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().
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().
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 |
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().
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().