Changeset 4414 in orxonox.OLD for orxonox/trunk
- Timestamp:
- May 31, 2005, 1:29:44 AM (19 years ago)
- Location:
- orxonox/trunk/src/world_entities
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/camera.cc
r4320 r4414 21 21 #include "world_entity.h" 22 22 #include "vector.h" 23 #include "event.h" 24 #include "event_handler.h" 23 25 24 26 using namespace std; … … 35 37 this->setClassID(CL_CAMERA, "Camera"); 36 38 this->target = new CameraTarget(); 39 40 EventHandler::getInstance()->subscribe(this, ES_GAME, KeyMapper::PEV_VIEW0); 41 EventHandler::getInstance()->subscribe(this, ES_GAME, KeyMapper::PEV_VIEW1); 42 EventHandler::getInstance()->subscribe(this, ES_GAME, KeyMapper::PEV_VIEW2); 43 EventHandler::getInstance()->subscribe(this, ES_GAME, KeyMapper::PEV_VIEW3); 44 EventHandler::getInstance()->subscribe(this, ES_GAME, KeyMapper::PEV_VIEW4); 45 EventHandler::getInstance()->subscribe(this, ES_GAME, KeyMapper::PEV_VIEW5); 37 46 38 47 this->setFovy(90); … … 182 191 183 192 193 void Camera::process(const Event &event) 194 { 195 if( event.type == KeyMapper::PEV_VIEW0) 196 { 197 this->setViewMode(VIEW_NORMAL); 198 } 199 else if( event.type == KeyMapper::PEV_VIEW1) 200 { 201 this->setViewMode(VIEW_BEHIND); 202 } 203 else if( event.type == KeyMapper::PEV_VIEW2) 204 { 205 this->setViewMode(VIEW_FRONT); 206 } 207 else if( event.type == KeyMapper::PEV_VIEW3) 208 { 209 this->setViewMode(VIEW_LEFT); 210 } 211 else if( event.type == KeyMapper::PEV_VIEW4) 212 { 213 this->setViewMode(VIEW_RIGHT); 214 } 215 else if( event.type == KeyMapper::PEV_VIEW5) 216 { 217 this->setViewMode(VIEW_TOP); 218 } 219 } 220 184 221 185 222 /////////////////// -
orxonox/trunk/src/world_entities/camera.h
r4338 r4414 9 9 #include "p_node.h" 10 10 #include "vector.h" 11 #include "event_listener.h" 11 12 12 13 class World; 13 14 class CameraTarget; 15 class Event; 14 16 15 17 enum ViewMode{VIEW_NORMAL, VIEW_BEHIND, VIEW_FRONT, VIEW_LEFT, VIEW_RIGHT, VIEW_TOP}; … … 19 21 This class controls the viewpoint from which the World is rendered. 20 22 */ 21 class Camera : public PNode 23 class Camera : public PNode, public EventListener 22 24 { 23 25 private: … … 46 48 void tick(float dt); 47 49 void apply (void); 50 51 void process(const Event &event); 48 52 }; 49 53 -
orxonox/trunk/src/world_entities/player.cc
r4413 r4414 284 284 void Player::process(const Event &event) 285 285 { 286 PRINTF(0)("Player got command!!!!!!!!!!!!!!!!!\n");287 286 if( event.type == KeyMapper::PEV_UP) 288 287 {
Note: See TracChangeset
for help on using the changeset viewer.