Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/lib/graphics/render2D/render_2d.cc @ 6783

Last change on this file since 6783 was 6299, checked in by bensch, 19 years ago

orxonox/trunk: syncing PNode to Element2D again

File size: 1.7 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 "element_2d.h"
23
24#include <math.h>
25
26#include "shell_command.h"
27SHELL_COMMAND(toggleNodeVisibility, Render2D, toggleNodesVisibility);
28
29using namespace std;
30
31/**
32 * standard constructor
33 */
34Render2D::Render2D ()
35{
36   this->setClassID(CL_RENDER_2D, "Render2D");
37   this->setName("Render2D");
38
39   this->showNodes = false;
40}
41
42/**
43 *  the singleton reference to this class
44 */
45Render2D* Render2D::singletonRef = NULL;
46
47/**
48 * standard deconstructor
49 */
50Render2D::~Render2D ()
51{
52  delete Element2D::getNullElement();
53
54  Render2D::singletonRef = NULL;
55}
56
57/**
58 * updates all the 2d-elements
59 * @param dt the timestep since last dt
60 */
61void Render2D::update(float dt)
62{
63  Element2D::getNullElement()->update2D(dt);
64}
65
66
67/**
68 * ticks all the 2d-elements
69 * @param dt the timestep since last dt
70 */
71void Render2D::tick(float dt)
72{
73  Element2D::getNullElement()->tick2D(dt);
74}
75
76/**
77 * renders all the Elements of the Render2D-engine's layer
78 * @param layer the Layer to draw (if E2D_LAYER_ALL then all layers will be drawn)
79 */
80void Render2D::draw(short layer) const
81{
82  GraphicsEngine::enter2DMode();
83  Element2D::getNullElement()->draw2D(E2D_LAYER_ALL);
84  if (this->showNodes)
85    Element2D::getNullElement()->debugDraw2D(0);
86  GraphicsEngine::leave2DMode();
87}
88
89
Note: See TracBrowser for help on using the repository browser.