- Timestamp:
- Apr 19, 2006, 1:38:23 PM (19 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/camera.cc
r7173 r7347 42 42 this->setClipRegion(.1, 2000); 43 43 44 this->setViewMode( VIEW_NORMAL);44 this->setViewMode(Camera::ViewNormal); 45 45 46 46 this->setParentMode(PNODE_ALL); … … 100 100 { 101 101 default: 102 case VIEW_NORMAL:102 case Camera::ViewNormal: 103 103 this->toFovy = 60.0; 104 104 this->setRelCoorSoft(-10, 5, 0); 105 105 this->target->setRelCoorSoft(0,0,0); 106 106 break; 107 case VIEW_BEHIND:108 break; 109 case VIEW_FRONT:107 case Camera::ViewBehind: 108 break; 109 case Camera::ViewFront: 110 110 this->toFovy = 120.0; 111 111 this->setRelCoorSoft(4, 0, 0, 5); 112 112 this->target->setRelCoorSoft(Vector(10,0,0), 5); 113 113 break; 114 case VIEW_LEFT:114 case Camera::ViewLeft: 115 115 this->toFovy = 90; 116 116 this->setRelCoorSoft(0, 1, -10, .5); 117 117 this->target->setRelCoorSoft(0,0,0); 118 118 break; 119 case VIEW_RIGHT:119 case Camera::ViewRight: 120 120 this->toFovy = 90; 121 121 this->setRelCoorSoft(Vector(0, 1, 10)); 122 122 this->target->setRelCoorSoft(0,0,0); 123 123 break; 124 case VIEW_TOP:124 case Camera::ViewTop: 125 125 this->toFovy= 120; 126 126 this->setRelCoorSoft(Vector(30, 50, 0)); … … 195 195 if( event.type == KeyMapper::PEV_VIEW0) 196 196 { 197 this->setViewMode( VIEW_NORMAL);197 this->setViewMode(Camera::ViewNormal); 198 198 } 199 199 else if( event.type == KeyMapper::PEV_VIEW1) 200 200 { 201 this->setViewMode( VIEW_BEHIND);201 this->setViewMode(Camera::ViewBehind); 202 202 } 203 203 else if( event.type == KeyMapper::PEV_VIEW2) 204 204 { 205 this->setViewMode( VIEW_FRONT);205 this->setViewMode(Camera::ViewFront); 206 206 } 207 207 else if( event.type == KeyMapper::PEV_VIEW3) 208 208 { 209 this->setViewMode( VIEW_LEFT);209 this->setViewMode(Camera::ViewLeft); 210 210 } 211 211 else if( event.type == KeyMapper::PEV_VIEW4) 212 212 { 213 this->setViewMode( VIEW_RIGHT);213 this->setViewMode(Camera::ViewRight); 214 214 } 215 215 else if( event.type == KeyMapper::PEV_VIEW5) 216 216 { 217 this->setViewMode( VIEW_TOP);217 this->setViewMode(Camera::ViewTop); 218 218 } 219 219 } -
trunk/src/world_entities/camera.h
r7173 r7347 15 15 class Event; 16 16 17 //! an enumerator for different types of view18 typedef enum ViewMode19 {20 VIEW_NORMAL,21 VIEW_BEHIND,22 VIEW_FRONT,23 VIEW_LEFT,24 VIEW_RIGHT,25 VIEW_TOP26 };27 17 28 18 //! Camera … … 32 22 class Camera : public PNode, public EventListener 33 23 { 34 public: 24 public: 25 //! an enumerator for different types of view 26 typedef enum ViewMode 27 { 28 ViewNormal, 29 ViewBehind, 30 ViewFront, 31 ViewLeft, 32 ViewRight, 33 ViewTop 34 }; 35 35 36 Camera(); 36 37 virtual ~Camera(); … … 48 49 void setToFovy(float toFovy) { this->toFovy = toFovy; }; 49 50 50 void setViewMode( ViewMode mode);51 void setViewMode(Camera::ViewMode mode); 51 52 inline const Vector& getViewVector() const { return this->viewVector; } 52 53 inline const Vector& getUpVector() const { return this->upVector; } … … 62 63 void process(const Event &event); 63 64 64 65 private: 65 66 CameraTarget* target; //!< The Target of the Camera (where this Camera Looks at) 66 67 … … 71 72 72 73 float toFovy; //!< The fovy-mode to iterate to. 73 ViewModecurrentMode; //!< The ViewMode the camera is in74 Camera::ViewMode currentMode; //!< The ViewMode the camera is in 74 75 75 76 Vector delay; … … 84 85 friend class Camera; //! The CameraTarget is a friend of Camera. noone else needs a CameraTarget, so noone else can create it. 85 86 86 87 private: 87 88 CameraTarget(); 88 89 89 90 public: 90 91 }; 91 92 -
trunk/src/world_entities/playable.cc
r7346 r7347 21 21 #include "player.h" 22 22 #include "state.h" 23 #include "camera.h" 24 23 25 #include "util/loading/load_param.h" 24 26 … … 251 253 */ 252 254 void Playable::setCameraMode(unsigned int cameraMode) 253 {} 255 { 256 State::getCamera()->setViewMode((Camera::ViewMode)cameraMode); 257 } 254 258 255 259 … … 265 269 else 266 270 { 271 this->enterPlaymode(playmode); 267 272 this->playmode = playmode; 268 273 return true; … … 289 294 * In this function all the actions that are required to enter the Playmode are described. 290 295 * e.g: camera, rotation, wait cycle and so on... 296 * 297 * on enter of this function the playmode is still the old playmode. 291 298 */ 292 299 void Playable::enterPlaymode(Playable::Playmode playmode) 293 300 { 294 295 } 296 301 switch(playmode) 302 { 303 default: 304 this->attachCamera(); 305 break; 306 case Playable::Horizontal: 307 this->setCameraMode(Camera::ViewTop); 308 break; 309 case Playable::Vertical: 310 this->setCameraMode(Camera::ViewLeft); 311 break; 312 case Playable::FromBehind: 313 this->setCameraMode(Camera::ViewBehind); 314 break; 315 } 316 } 297 317 /** 298 318 * @brief helps us colliding Playables -
trunk/src/world_entities/playable.h
r7346 r7347 60 60 void attachCamera(); 61 61 void detachCamera(); 62 v irtual void setCameraMode(unsigned int cameraMode = 0);62 void setCameraMode(unsigned int cameraMode = 0); 63 63 bool playmodeSupported(Playable::Playmode playmode) const { return this->supportedPlaymodes & playmode; }; 64 64 bool setPlaymode(Playable::Playmode playmode);
Note: See TracChangeset
for help on using the changeset viewer.