play_field.h

Go to the documentation of this file.
00001 
00014 #ifndef _PLAY_FIELD_H_
00015 #define _PLAY_FIELD_H_
00016 
00017 #include <Inventor/fields/SoSFTime.h>
00018 #include <Inventor/nodes/SoTranslation.h>
00019 
00020 #include "graphical_node.h"
00021 #include "time_updateable.h"
00022 #include "scene_configuration.h"
00023 #include "templates/callable_back.h"
00024 
00025 class Avatar;
00026 class PlayBoxGraphics;
00027 class PlayBoxPhysics;
00028 class Bubble;
00029 class BubbleGenerator;
00030 class BubbleField;
00031 
00037 class PlayField: public TimeUpdateable, public GraphicalNode,
00038         public Templates::CallableBack<Avatar>,
00039         public Templates::CallableBack<BubbleField>
00040 {
00041         private:
00042 
00044                 static const float PLAY_BOX_SIDE_HALF_SIZE;
00045 
00047                 static const float PLAY_BOX_DEPTH;
00048 
00050                 static const float PLAY_BOX_NEAR_WALL_BOUND;
00051 
00053                 static const float DEFAULT_WALL_OFFSET;
00054 
00056                 PlayBoxGraphics *_graphics;
00057 
00059                 PlayBoxPhysics *_physics;
00060 
00062                 Avatar *_avatar;
00063 
00065                 Camera *_camera;
00066 
00068                 BubbleField *_bubbleField;
00069 
00071                 Bubble *_flyingBubble;
00072 
00074                 bool _bubbleIsReady;
00075 
00077                 BubbleGenerator *_bubbleGenerator;
00078 
00080                 float _wallOffset;
00081 
00083                 SoTranslation* _wallTranslation;
00084 
00086                 float _wallSpeed;
00087 
00089                 void (*_failedGameEndFunc)();
00090 
00091         private:
00092 
00093                 // Disable copy constructor and assignment operator
00094                 PlayField(const PlayField &);
00095                 PlayField & operator=(const PlayField &);
00096 
00100                 void createNewBubble();
00101 
00109                 SbVec3f coordsInBubbleField(const SbVec3f& pfCoords);
00110 
00111         public:
00112 
00118                 PlayField(const SceneConfiguration &sceneConfig);
00119 
00123                 ~PlayField();
00124 
00125                 // Override
00126                 virtual void timeUpdate(float dt);
00127 
00128                 // Override
00129                 virtual void callableBackNotify(BubbleField *subject);
00130 
00131                 // Override
00132                 virtual void callableBackNotify(Avatar *subject);
00133 
00137                 void fire();
00138 
00145                 void launchBubble();
00146 
00150                 static float getSizeHalfSize() { return PLAY_BOX_SIDE_HALF_SIZE; }
00151 
00155                 static float getDepth() { return PLAY_BOX_DEPTH; }
00156 
00160                 static float getNearWallBound() { return PLAY_BOX_NEAR_WALL_BOUND; }
00161 };
00162 
00163 #endif

Generated on Sat Dec 20 19:21:24 2008 for PGR2008 by  doxygen 1.5.6