/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: Benjamin Grauer co-programmer: ... */ #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS #include "render_2d.h" #include "graphics_engine.h" #include "class_list.h" #include "list.h" #include "element_2d.h" #include #include "shell_command.h" SHELL_COMMAND(toggleNodeVisibility, Render2D, toggleNodesVisibility); using namespace std; /** * standard constructor */ Render2D::Render2D () { this->setClassID(CL_RENDER_2D, "Render2D"); this->setName("Render2D"); this->showNodes = false; } /** * the singleton reference to this class */ Render2D* Render2D::singletonRef = NULL; /** * standard deconstructor */ Render2D::~Render2D () { delete NullElement2D::getInstance(); Render2D::singletonRef = NULL; } /** * updates all the 2d-elements * @param dt the timestep since last dt */ void Render2D::update(float dt) { NullElement2D::getInstance()->update2D(dt); } /** * ticks all the 2d-elements * @param dt the timestep since last dt */ void Render2D::tick(float dt) { NullElement2D::getInstance()->tick2D(dt); } /** * renders all the Elements of the Render2D-engine's layer * @param layer the Layer to draw (if E2D_LAYER_ALL then all layers will be drawn) */ void Render2D::draw(short layer) const { GraphicsEngine::enter2DMode(); NullElement2D::getInstance()->draw2D(E2D_LAYER_ALL); if (this->showNodes) NullElement2D::getInstance()->debugDraw2D(0); GraphicsEngine::leave2DMode(); }