D:/simple_rts/include/UnitSelecter.h

Go to the documentation of this file.
00001 #pragma once
00002 
00003 #include "Updater.h"
00004 #include "Level.h"
00005 
00006 #include "OgreCamera.h"
00007 #include "OgreEntity.h"
00008 #include "OgreMovableObject.h"
00009 #include "OgreOverlay.h"
00010 #include "OgreSceneNode.h"
00011 #include "OgreRay.h"
00012 #include "OgreVector2.h"
00013 
00014 #include "OgreEntity.h"
00015 #include "OgreSceneNode.h"
00016 
00017 #include <vector>
00018 
00019 using Ogre::Camera;
00020 using Ogre::Entity;
00021 using Ogre::MovableObject;
00022 using Ogre::Overlay;
00023 using Ogre::SceneNode;
00024 using Ogre::Ray;
00025 using Ogre::RaySceneQuery;
00026 using Ogre::Vector2;
00027 
00028 using std::vector;
00029 
00030 // ----------------------------------------------------------------------------
00031 namespace ASR
00032 {
00033         class Team;
00034 
00035         // ----------------------------------------------------------------------------
00036         class UnitSelecter : public Updater
00037         {
00038         // HACKS
00039         // ----------------------------------------------------------------------------
00040         private:
00041                 Entity*                 mCubes[5];
00042                 SceneNode*              mNodes[5];
00043 
00044         // Data Storage
00045         // ----------------------------------------------------------------------------
00046         private:
00047                 Camera*                 mCamera;
00048                 
00049                 RaySceneQuery*  mRayQuery;
00050                 Team*                   mTeam;
00051 
00052                 // Symmetric coords [-1 1]
00053                 float                   mAbsMouse[2];
00054                 bool                    mFirstPoint;
00055 
00056                 // Use Planes to draw each of the 4 sides
00057                 Overlay*                mOverlay;
00058 
00059                 // The boundaries of the selection region
00060                 Vector2                 mBounds[2];
00061 
00062                 vector<Unit*>   mSelectedUnits;
00063 
00064         // Construction
00065         // ----------------------------------------------------------------------------
00066         public:
00067                 UnitSelecter ( Team* team, Camera* camera );
00068                 ~UnitSelecter(void);
00069 
00070 
00071         // Updating
00072         // ----------------------------------------------------------------------------
00073         public:
00074                 bool updateBeforeFrame ( const FrameEvent& e, const InputReader* inputDevice );
00075                 bool updateAfterFrame ( const FrameEvent& e, const InputReader* inputDevice );
00076 
00077 
00078         // Helper Functions
00079         // ----------------------------------------------------------------------------
00080         private:
00081                 void _moveUnits ();
00082                 void _selectUnits ();
00083 
00084                 void _unselectDeadUnits ();
00085                 void _createActiveGroup () const;
00086 
00087                 void _unselectCurrect ();
00088 
00089                 void _selectUnit ( Unit* unit );
00090                 void _unselectUnit ( Unit* unit );
00091 
00097                 Vector3 _getMousePosition ();
00098         };
00099 }

Generated on Sun Jun 25 19:23:43 2006 for Valors End by  doxygen 1.4.7