Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/spaceshipcontrol/src/lib/graphics/render2D/render_2d.cc @ 6014

Last change on this file since 6014 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
Line 
1/*
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:
12   main-programmer: Benjamin Grauer
13   co-programmer: ...
14*/
15
16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
17
18#include "render_2d.h"
19
20#include "graphics_engine.h"
21#include "class_list.h"
22#include "list.h"
23#include "element_2d.h"
24
25#include <math.h>
26
27#include "shell_command.h"
28SHELL_COMMAND(toggleNodeVisibility, Render2D, toggleNodesVisibility);
29
30using namespace std;
31
32/**
33 * standard constructor
34 */
35Render2D::Render2D ()
36{
37   this->setClassID(CL_RENDER_2D, "Render2D");
38   this->setName("Render2D");
39
40   this->showNodes = false;
41}
42
43/**
44 *  the singleton reference to this class
45 */
46Render2D* Render2D::singletonRef = NULL;
47
48/**
49 * standard deconstructor
50 */
51Render2D::~Render2D ()
52{
53  delete NullElement2D::getInstance();
54
55  Render2D::singletonRef = NULL;
56}
57
58/**
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/**
69 * ticks all the 2d-elements
70 * @param dt the timestep since last dt
71 */
72void Render2D::tick(float dt)
73{
74  NullElement2D::getInstance()->tick2D(dt);
75}
76
77/**
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)
80 */
81void Render2D::draw(short layer) const
82{
83  GraphicsEngine::enter2DMode();
84  NullElement2D::getInstance()->draw2D(E2D_LAYER_ALL);
85  if (this->showNodes)
86    NullElement2D::getInstance()->debugDraw2D(0);
87  GraphicsEngine::leave2DMode();
88}
89
90
Note: See TracBrowser for help on using the repository browser.