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