Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/spaceshipcontrol/src/world_entities/player.cc @ 5853

Last change on this file since 5853 was 5853, checked in by snellen, 18 years ago

player.cc and player.h updated (both files in ../src/world_entities)

File size: 1.4 KB
RevLine 
[4592]1/*
[3471]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:
[5841]12   main-programmer: Silvan Nellen
13   co-programmer: Benjamin Knecht
[3471]14*/
15
16#include "player.h"
[3596]17
[5355]18#include "factory.h"
[4826]19
[3620]20#include "list.h"
21
[4404]22#include "event_handler.h"
[4389]23
[4404]24#include "event.h"
[4287]25
[3471]26using namespace std;
27
[4010]28
[3471]29/**
[4885]30 * creates a new Player
[3471]31*/
[4762]32Player::Player()
[3471]33{
[4780]34  this->init();
[3471]35}
36
[4975]37
[4010]38/**
[4975]39 *  destructs the player, deletes alocated memory
40 */
41Player::~Player ()
42{
43}
44
[5395]45
[4975]46/**
[4780]47 * initializes a Player
48 */
49void Player::init()
50{
[5037]51//  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
[4780]52  this->setClassID(CL_PLAYER, "Player");
[5144]53
[5300]54  PRINTF(4)("PLAYER INIT\n");
[4834]55
[4780]56}
57
[5847]58/**
[5853]59 * subscribe to all events the controllable needs
[5847]60 */
[5840]61void Player::subscribeEvents()
62{
[5853]63  /*EventHandler* evh = EventHandler::getInstance();
[5850]64  for (int i = 1; i < SDLK_LAST; i++)
65   {
66     if (!evh->isSubscribed(ES_GAME, i))
67          evh->subscribe(this, ES_GAME, i);
68   }
[5853]69  */
[5840]70}
[4780]71
[4404]72void Player::process(const Event &event)
73{
[5839]74  this->controllable->process(event);
[4404]75}
[5435]76
[5847]77
[5852]78void Player::setControllable(Playable* controllalble)
[5840]79 {
[5853]80   //todo get keyset an subscribe to the needed keys
[5840]81   this->controllable = controllable;
82 }
83
84
[5847]85
[5841]86Playable* Player::getControllable()
[5840]87{
88  return controllable;
89}
90
Note: See TracBrowser for help on using the repository browser.