Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/proto/proto_world_entity.cc @ 4866

Last change on this file since 4866 was 4838, checked in by bensch, 19 years ago

orxonox/trunk: Element2D added → will be moved to lib/graphics afterwards
ProtoClass update
EventListeners do not have to be unsubscribed externally, but still one listener won't unsubscribe

File size: 1.9 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: ...
13   co-programmer: ...
14*/
15
16#include "proto_world_entity.h"
17#include "glincl.h"
18#include "stdincl.h"
19#include "vector.h"
20#include "model.h"
21
22using namespace std;
23
24
25/**
26 * constructs and loads a ProtoWorldEntity from a XML-element
27 * @param root the XML-element to load from
28 */
29ProtoWorldEntity::ProtoWorldEntity(const TiXmlElement* root)
30{
31  this->init();
32  if (root != NULL)
33    this->loadParams(root);
34}
35
36
37/**
38 * standard deconstructor
39 */
40ProtoWorldEntity::~ProtoWorldEntity ()
41{
42
43}
44
45/**
46 * initializes the ProtoWorldEntity
47 * @todo change this to what you wish
48 */
49void ProtoWorldEntity::init(void)
50{
51  this->setClassID(CL_PROTO_WORLD_ENTITY, )
52  ...
53}
54
55/**
56 * loads a ProtoWorldEntity from a XML-element
57 * @param root the XML-element to load from
58 * @todo make the class Loadable
59 */
60void ProtoWorldEntity::loadParams(const TiXmlElement* root)
61{
62  // all the clases this Entity is directly derived from must be called in this way, to load all settings.
63  static_cast<WorldEntity*>(this)->loadParam(root);
64
65  ...
66}
67
68
69/**
70 * advances the ProtoWorldEntity about time seconds
71 * @param time the Time to step
72 */
73ProtoWorldEntity::tick(float time)
74{
75
76}
77
78/**
79 * draws this worldEntity
80 */
81void ProtoWorldEntity::draw ()
82{
83  glMatrixMode(GL_MODELVIEW);
84  glPushMatrix();
85  float matrix[4][4];
86
87  /* translate */
88  glTranslatef (this->getAbsCoor ().x,
89                this->getAbsCoor ().y,
90                this->getAbsCoor ().z);
91  /* rotate */
92  this->getAbsDir().matrix(matrix);
93  glMultMatrixf((float*)matrix);
94
95  if (model)
96    model->draw();
97  glPopMatrix();
98}
Note: See TracBrowser for help on using the repository browser.