Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 8458 was 7840, checked in by bensch, 18 years ago

trunk: Elements that are supposed to be on the Background stay there:

Changed:
Element2D: render from - to - LAYERS
Render2D: Renders from - to - LAYERS
GraphicsEngine: new function drawBackgroundElements
ObjectManager: new List OM_BACKGROUND
Skybox/sphere: in OM_LIST OM_BACKGROUND

@patrick: do you like it too ??

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