Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/render2D/render_2d.cc @ 6103

Last change on this file since 6103 was 5417, checked in by bensch, 19 years ago

orxonox/trunk: visibility of Element2D-debug-draw through
ShellCommand:: Render2D toggleNodeVisibility

File size: 1.8 KB
RevLine 
[4744]1/*
[3655]2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
[5399]12   main-programmer: Benjamin Grauer
[3655]13   co-programmer: ...
14*/
15
[5398]16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
[3655]17
[4839]18#include "render_2d.h"
[3655]19
[4840]20#include "graphics_engine.h"
21#include "class_list.h"
22#include "list.h"
23#include "element_2d.h"
24
[4862]25#include <math.h>
26
[5417]27#include "shell_command.h"
28SHELL_COMMAND(toggleNodeVisibility, Render2D, toggleNodesVisibility);
29
[3655]30using namespace std;
31
32/**
[4838]33 * standard constructor
34 */
[4839]35Render2D::Render2D ()
[3655]36{
[4839]37   this->setClassID(CL_RENDER_2D, "Render2D");
38   this->setName("Render2D");
[5417]39
40   this->showNodes = false;
[3655]41}
42
43/**
[4838]44 *  the singleton reference to this class
45 */
[4839]46Render2D* Render2D::singletonRef = NULL;
[3655]47
48/**
[4840]49 * standard deconstructor
[4838]50 */
[4839]51Render2D::~Render2D ()
[3655]52{
[5286]53  delete NullElement2D::getInstance();
54
[4839]55  Render2D::singletonRef = NULL;
[3655]56}
[4840]57
58/**
[5406]59 * updates all the 2d-elements
60 * @param dt the timestep since last dt
61 */
62void Render2D::update(float dt)
63{
64  NullElement2D::getInstance()->update2D(dt);
65}
66
67
68/**
[4862]69 * ticks all the 2d-elements
70 * @param dt the timestep since last dt
71 */
[4849]72void Render2D::tick(float dt)
73{
[5401]74  NullElement2D::getInstance()->tick2D(dt);
[4849]75}
76
77/**
[5397]78 * renders all the Elements of the Render2D-engine's layer
79 * @param layer the Layer to draw (if E2D_LAYER_ALL then all layers will be drawn)
[4849]80 */
[5404]81void Render2D::draw(short layer) const
[4847]82{
[4848]83  GraphicsEngine::enter2DMode();
[5401]84  NullElement2D::getInstance()->draw2D(E2D_LAYER_ALL);
[5417]85  if (this->showNodes)
86    NullElement2D::getInstance()->debugDraw2D(0);
[4848]87  GraphicsEngine::leave2DMode();
[4847]88}
[5399]89
90
Note: See TracBrowser for help on using the repository browser.