Changeset 10237 in orxonox.OLD for branches/playability/src/world_entities
- Timestamp:
- Jan 15, 2007, 11:51:37 PM (18 years ago)
- Location:
- branches/playability/src/world_entities
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/camera.cc
r9869 r10237 44 44 45 45 this->setParentMode(PNODE_ALL); 46 this->eventHandling = true; 47 48 46 49 } 47 50 … … 100 103 default: 101 104 case Camera::ViewNormal: 105 { 102 106 this->toFovy = 60.0; 103 107 this->setRelCoorSoft(-10, 5, 0); 104 108 this->target->setRelCoorSoft(0,0,0); 105 109 break; 110 } 106 111 case Camera::ViewBehind: 107 112 break; 108 113 case Camera::ViewFront: 114 { 109 115 this->toFovy = 120.0; 110 116 this->setRelCoorSoft(4, 0, 0, 5); 111 117 this->target->setRelCoorSoft(Vector(10,0,0), 5); 112 118 break; 119 } 113 120 case Camera::ViewLeft: 121 { 114 122 this->toFovy = 90; 115 123 this->setRelCoorSoft(0, 1, -10, .5); 116 124 this->target->setRelCoorSoft(0,0,0); 117 125 break; 126 } 118 127 case Camera::ViewRight: 128 { 119 129 this->toFovy = 90; 120 130 this->setRelCoorSoft(Vector(0, 1, 10)); 121 131 this->target->setRelCoorSoft(0,0,0); 122 132 break; 133 } 123 134 case Camera::ViewTop: 135 { 124 136 this->toFovy= 120; 125 this->setRelCoorSoft(Vector(30, 50, 0)); 126 this->target->setRelCoorSoft(35,0,0); 137 this->setRelCoor(Vector(-0.05, 40, 0)); 138 this->target->setRelCoor(0,0,0); 139 } 127 140 } 128 141 } … … 192 205 void Camera::process(const Event &event) 193 206 { 194 if ( event.type == KeyMapper::PEV_VIEW0)207 if (eventHandling == true) 195 208 { 196 this->setViewMode(Camera::ViewNormal); 197 } 198 else if( event.type == KeyMapper::PEV_VIEW1) 199 { 200 this->setViewMode(Camera::ViewBehind); 201 } 202 else if( event.type == KeyMapper::PEV_VIEW2) 203 { 204 this->setViewMode(Camera::ViewFront); 205 } 206 else if( event.type == KeyMapper::PEV_VIEW3) 207 { 208 this->setViewMode(Camera::ViewLeft); 209 } 210 else if( event.type == KeyMapper::PEV_VIEW4) 211 { 212 this->setViewMode(Camera::ViewRight); 213 } 214 else if( event.type == KeyMapper::PEV_VIEW5) 215 { 216 this->setViewMode(Camera::ViewTop); 209 if( event.type == KeyMapper::PEV_VIEW0) 210 { 211 this->setViewMode(Camera::ViewNormal); 212 } 213 else if( event.type == KeyMapper::PEV_VIEW1) 214 { 215 this->setViewMode(Camera::ViewBehind); 216 } 217 else if( event.type == KeyMapper::PEV_VIEW2) 218 { 219 this->setViewMode(Camera::ViewFront); 220 } 221 else if( event.type == KeyMapper::PEV_VIEW3) 222 { 223 this->setViewMode(Camera::ViewLeft); 224 } 225 else if( event.type == KeyMapper::PEV_VIEW4) 226 { 227 this->setViewMode(Camera::ViewRight); 228 } 229 else if( event.type == KeyMapper::PEV_VIEW5) 230 { 231 this->setViewMode(Camera::ViewTop); 232 } 217 233 } 218 234 } -
branches/playability/src/world_entities/camera.h
r9869 r10237 58 58 inline float distance(const PNode* node) const { return distance(node->getAbsCoor()); } 59 59 60 inline void setEventHandling(bool b) {this->eventHandling = b;} 61 inline bool getEventHandling() {return this->eventHandling;} 62 60 63 void tick(float dt); 61 64 void apply (); … … 66 69 private: 67 70 CameraTarget* target; //!< The Target of the Camera (where this Camera Looks at) 71 72 bool eventHandling; //!< True, if the Camera handles the processing of events itself. Set false to overwrite the standard handling. 68 73 69 74 float fovy; //!< The field of view Angle (in degrees). -
branches/playability/src/world_entities/space_ships/space_ship.cc
r10235 r10237 58 58 #include "state.h" 59 59 #include "player.h" 60 #include "camera.h" 60 61 61 62 … … 436 437 this->toList( OM_GROUP_00); 437 438 State::getPlayer()->hud().setOverlayActive(false); 439 State::getCamera()->setEventHandling(true); 438 440 //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( false); 439 441 //this->detachCamera(); … … 619 621 this->previousWeaponConfig(); 620 622 623 if (!(State::getCamera()->getEventHandling())) 624 { 625 if( event.type == KeyMapper::PEV_VIEW0) 626 { 627 State::getCamera()->setViewMode(Camera::ViewNormal); 628 State::getCameraTargetNode()->setParent(this); 629 State::getCamera()->setParent(this); 630 } 631 else if( event.type == KeyMapper::PEV_VIEW1) 632 { 633 State::getCamera()->setViewMode(Camera::ViewBehind); 634 State::getCameraTargetNode()->setParent(this); 635 State::getCamera()->setParent(this); 636 } 637 else if( event.type == KeyMapper::PEV_VIEW2) 638 { 639 State::getCamera()->setViewMode(Camera::ViewFront); 640 State::getCameraTargetNode()->setParent(this); 641 State::getCamera()->setParent(this); 642 } 643 else if( event.type == KeyMapper::PEV_VIEW3) 644 { 645 State::getCamera()->setViewMode(Camera::ViewLeft); 646 State::getCameraTargetNode()->setParent(this); 647 State::getCamera()->setParent(this); 648 } 649 else if( event.type == KeyMapper::PEV_VIEW4) 650 { 651 State::getCamera()->setViewMode(Camera::ViewRight); 652 State::getCameraTargetNode()->setParent(this); 653 State::getCamera()->setParent(this); 654 } 655 else if( event.type == KeyMapper::PEV_VIEW5) 656 { 657 State::getCamera()->setViewMode(Camera::ViewTop); 658 State::getCameraTargetNode()->setParent(this->travelNode); 659 State::getCamera()->setParent(this->travelNode); 660 } 661 } 662 621 663 622 664 /* … … 837 879 State::getCameraNode()->setParentSoft(this->travelNode); 838 880 //State::getCameraNode()->setParentSoft(this); 839 State::getCameraNode()->setRelCoorSoft(-0.01, 40, 0);881 //State::getCameraNode()->setRelCoorSoft(-0.01, 40, 0); 840 882 State::getCameraTargetNode()->setParentSoft(this->travelNode); 841 883 //State::getCameraTargetNode()->setParentSoft(this); 842 State::getCameraTargetNode()->setRelCoorSoft(0,0,0); 884 //State::getCameraTargetNode()->setRelCoorSoft(0,0,0); 885 this->setCameraMode(Camera::ViewTop); 886 State::getCamera()->setEventHandling(false); 887 registerEvent(KeyMapper::PEV_VIEW0); 888 registerEvent(KeyMapper::PEV_VIEW1); 889 registerEvent(KeyMapper::PEV_VIEW2); 890 registerEvent(KeyMapper::PEV_VIEW3); 891 registerEvent(KeyMapper::PEV_VIEW4); 892 registerEvent(KeyMapper::PEV_VIEW5); 893 894 State::getCamera()->setParentMode(PNODE_MOVEMENT); 843 895 844 896 this->debugNode(1);
Note: See TracChangeset
for help on using the changeset viewer.