Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7868 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
May 26, 2006, 1:21:32 PM (19 years ago)
Author:
bensch
Message:

trunk: merge Check in the Event-changes:
r7867 | bensch | 2006-05-26 13:19:46 +0200 (Fri, 26 May 2006) | 1 line

Events better subscribed


r7866 | bensch | 2006-05-26 13:11:10 +0200 (Fri, 26 May 2006) | 1 line

Events are subscribed at the EventListener, and not the EventHandler

Location:
trunk/src/world_entities
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/camera.cc

    r7347 r7868  
    1616
    1717#include "camera.h"
    18 
    19 #include "event_handler.h"
    20 
    21 using namespace std;
    22 
     18#include "key_mapper.h"
    2319
    2420/**
     
    3127  this->target = new CameraTarget();
    3228
    33   EventHandler::getInstance()->subscribe(this, ES_GAME, KeyMapper::PEV_VIEW0);
    34   EventHandler::getInstance()->subscribe(this, ES_GAME, KeyMapper::PEV_VIEW1);
    35   EventHandler::getInstance()->subscribe(this, ES_GAME, KeyMapper::PEV_VIEW2);
    36   EventHandler::getInstance()->subscribe(this, ES_GAME, KeyMapper::PEV_VIEW3);
    37   EventHandler::getInstance()->subscribe(this, ES_GAME, KeyMapper::PEV_VIEW4);
    38   EventHandler::getInstance()->subscribe(this, ES_GAME, KeyMapper::PEV_VIEW5);
     29  this->subscribeEvent(ES_GAME, KeyMapper::PEV_VIEW0);
     30  this->subscribeEvent(ES_GAME, KeyMapper::PEV_VIEW1);
     31  this->subscribeEvent(ES_GAME, KeyMapper::PEV_VIEW2);
     32  this->subscribeEvent(ES_GAME, KeyMapper::PEV_VIEW3);
     33  this->subscribeEvent(ES_GAME, KeyMapper::PEV_VIEW4);
     34  this->subscribeEvent(ES_GAME, KeyMapper::PEV_VIEW5);
    3935
    4036  this->setFovy(90);
  • trunk/src/world_entities/creatures/md2_creature.cc

    r7337 r7868  
    3232#include "util/loading/factory.h"
    3333#include "key_mapper.h"
    34 #include "event_handler.h"
    3534
    3635#include "graphics_engine.h"
  • trunk/src/world_entities/playable.cc

    r7713 r7868  
    1616
    1717#include "playable.h"
    18 #include "event_handler.h"
     18
     19#include "key_mapper.h"
    1920
    2021#include "player.h"
     
    225226
    226227    // unsubscibe all events.
    227     EventHandler* evh = EventHandler::getInstance();
    228228    std::vector<int>::iterator ev;
    229229    for (ev = this->events.begin(); ev != events.end(); ev++)
    230       evh->unsubscribe( ES_GAME, (*ev));
     230      player->unsubscribeEvent(ES_GAME, (*ev));
    231231
    232232    // leave the entity
     
    251251
    252252    /*EventHandler*/
    253     EventHandler* evh = EventHandler::getInstance();
    254253    std::vector<int>::iterator ev;
    255254    for (ev = this->events.begin(); ev != events.end(); ev++)
    256       evh->subscribe(player, ES_GAME, (*ev));
     255      player->subscribeEvent(ES_GAME, (*ev));
    257256
    258257    this->enter();
     
    440439
    441440  if (this->currentPlayer != NULL)
    442     EventHandler::getInstance()->subscribe(this->currentPlayer, ES_GAME, eventType);
     441    this->currentPlayer->subscribeEvent(ES_GAME, eventType);
    443442}
    444443
     
    453452
    454453  if (this->currentPlayer != NULL)
    455     EventHandler::getInstance()->unsubscribe(ES_GAME, eventType);
     454    this->currentPlayer->unsubscribeEvent(ES_GAME, eventType);
    456455}
    457456
  • trunk/src/world_entities/player.cc

    r7337 r7868  
    4040  this->hud.show();
    4141
    42   EventHandler::getInstance()->subscribe(this, ES_GAME, KeyMapper::PEV_CHANGE_SHIP);
     42  this->subscribeEvent(ES_GAME, KeyMapper::PEV_CHANGE_SHIP);
    4343}
    4444
  • trunk/src/world_entities/space_ships/helicopter.cc

    r7810 r7868  
    2828
    2929#include "key_mapper.h"
    30 #include "event_handler.h"
    3130#include "state.h"
    3231
  • trunk/src/world_entities/space_ships/hover.cc

    r7337 r7868  
    2626#include "util/loading/factory.h"
    2727#include "key_mapper.h"
    28 #include "event_handler.h"
    2928#include "state.h"
    3029
  • trunk/src/world_entities/space_ships/space_ship.cc

    r7346 r7868  
    3131#include "util/loading/factory.h"
    3232#include "key_mapper.h"
    33 #include "event_handler.h"
    3433
    3534#include "network_game_manager.h"
  • trunk/src/world_entities/space_ships/turbine_hover.cc

    r7348 r7868  
    2626#include "util/loading/factory.h"
    2727#include "key_mapper.h"
    28 #include "event_handler.h"
    2928#include "state.h"
    3029
     
    3231#include "dot_emitter.h"
    3332#include "sprite_particles.h"
    34 
    35 using namespace std;
    3633
    3734CREATE_FACTORY(TurbineHover, CL_TURBINE_HOVER);
     
    176173
    177174
    178   //add events to the eventlist
    179   registerEvent(KeyMapper::PEV_FORWARD);
    180   registerEvent(KeyMapper::PEV_BACKWARD);
    181   registerEvent(KeyMapper::PEV_LEFT);
    182   registerEvent(KeyMapper::PEV_RIGHT);
    183   registerEvent(KeyMapper::PEV_UP);
    184   registerEvent(KeyMapper::PEV_DOWN);
    185   registerEvent(KeyMapper::PEV_FIRE1);
    186   registerEvent(KeyMapper::PEV_NEXT_WEAPON);
    187   registerEvent(KeyMapper::PEV_PREVIOUS_WEAPON);
    188   registerEvent(EV_MOUSE_MOTION);
     175  //add events to the eventlist of the Playable
     176  this->registerEvent(KeyMapper::PEV_FORWARD);
     177  this->registerEvent(KeyMapper::PEV_BACKWARD);
     178  this->registerEvent(KeyMapper::PEV_LEFT);
     179  this->registerEvent(KeyMapper::PEV_RIGHT);
     180  this->registerEvent(KeyMapper::PEV_UP);
     181  this->registerEvent(KeyMapper::PEV_DOWN);
     182  this->registerEvent(KeyMapper::PEV_FIRE1);
     183  this->registerEvent(KeyMapper::PEV_NEXT_WEAPON);
     184  this->registerEvent(KeyMapper::PEV_PREVIOUS_WEAPON);
     185  this->registerEvent(EV_MOUSE_MOTION);
    189186
    190187  dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false);
  • trunk/src/world_entities/weapons/crosshair.cc

    r7221 r7868  
    1717
    1818#include "crosshair.h"
    19 #include "event_handler.h"
    2019
    2120#include "util/loading/load_param.h"
     
    6564  this->material = new Material;
    6665
    67   //EventHandler::getInstance()->subscribe(this, ES_GAME, EV_MOUSE_MOTION);
     66  //this->subscribeEvent(ES_GAME, EV_MOUSE_MOTION);
    6867
    6968  // center the mouse on the screen, and also hide the cursors
Note: See TracChangeset for help on using the changeset viewer.