Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7262 was 6512, checked in by bensch, 19 years ago

orxonox/trunk: loadParams is now virtual.
ALL THE CLASSES HAVE TO CALL

SuperClass::loadParams(root);

isntead of:
static_cast<SuperClass*>(this)→loadParams(root);

which was quite stupid anyways

File size: 2.0 KB
RevLine 
[4838]1/*
[1853]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.
[1855]10
11   ### File Specific:
[3761]12   main-programmer: ...
[1855]13   co-programmer: ...
[1853]14*/
15
[3761]16#include "proto_world_entity.h"
[1853]17
[1856]18using namespace std;
[1853]19
[3559]20
[3564]21/**
[4838]22 * constructs and loads a ProtoWorldEntity from a XML-element
23 * @param root the XML-element to load from
24 */
[4483]25ProtoWorldEntity::ProtoWorldEntity(const TiXmlElement* root)
26{
27  this->init();
[4838]28  if (root != NULL)
29    this->loadParams(root);
[4483]30}
31
32
33/**
[4838]34 * standard deconstructor
35 */
36ProtoWorldEntity::~ProtoWorldEntity ()
[3566]37{
38
39}
40
[5509]41
[3762]42/**
[4838]43 * initializes the ProtoWorldEntity
44 * @todo change this to what you wish
45 */
[5509]46void ProtoWorldEntity::init()
[4483]47{
[5509]48  this->setClassID(CL_PROTO_WORLD_ENTITY, "ProtoWorldEntity");
49
50  /**
51   * @todo: Write CL_PROTO_WORLD_ENTITY INTO THE src/defs/class_id.h (your own definition)
52   */
53
[4483]54}
55
[5509]56
[4483]57/**
[4838]58 * loads a ProtoWorldEntity from a XML-element
59 * @param root the XML-element to load from
60 * @todo make the class Loadable
61 */
[4483]62void ProtoWorldEntity::loadParams(const TiXmlElement* root)
63{
[4838]64  // all the clases this Entity is directly derived from must be called in this way, to load all settings.
[6512]65  WorldEntity::loadParam(root);
[4483]66
[5509]67
68  /**
69   * @todo: make the class Loadable
70   */
[4483]71}
72
73
74/**
[4838]75 * advances the ProtoWorldEntity about time seconds
76 * @param time the Time to step
77 */
[3762]78ProtoWorldEntity::tick(float time)
79{
[1853]80
[3762]81}
82
[3245]83/**
[4838]84 * draws this worldEntity
85 */
[5509]86void ProtoWorldEntity::draw () const
[4838]87{
[3559]88  glMatrixMode(GL_MODELVIEW);
89  glPushMatrix();
90  float matrix[4][4];
[4838]91
[3559]92  /* translate */
[4838]93  glTranslatef (this->getAbsCoor ().x,
94                this->getAbsCoor ().y,
95                this->getAbsCoor ().z);
[3559]96  /* rotate */
[3761]97  this->getAbsDir().matrix(matrix);
[3559]98  glMultMatrixf((float*)matrix);
99
[3761]100  if (model)
[3566]101    model->draw();
[3559]102  glPopMatrix();
103}
[5509]104
105
106/**
107 *
108 *
109 */
110void ProtoWorldEntity::collidesWith (WorldEntity* entity, const Vector& location)
111{
112
113}
Note: See TracBrowser for help on using the repository browser.