Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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