controlGroupsHandler.cpp

Go to the documentation of this file.
00001 /*
00002  * controlGroupHandler.cpp
00003  *
00004  *  Created on: Jan 15, 2013
00005  *      Author: sushil
00006  */
00007 
00008 
00009 #include <controlGroupsHandler.h>
00010 #include <GraphicsInteractionManager.h>
00011 #include "DEBUG.h"
00012 
00013 OgreGFX::ControlGroupsHandler::ControlGroupsHandler(GraphicsInteractionManager *gim){
00014         this->gfx = gim;
00015         DEBUG(std::cout << "Handling control group handler initialization" << std::endl;)
00016         for (int i = 0; i < MAX_CONTROL_GROUPS; i++){
00017                 groups[i] = std::list<OgreGFX::GFXNode *>();
00018                 groups[i].clear();
00019         }
00020         OISKeyToGroupIndexMap.clear();
00021         OISKeyToGroupIndexMap[OIS::KC_0] = 0;
00022         OISKeyToGroupIndexMap[OIS::KC_1] = 1;
00023         OISKeyToGroupIndexMap[OIS::KC_2] = 2;
00024         OISKeyToGroupIndexMap[OIS::KC_3] = 3;
00025         OISKeyToGroupIndexMap[OIS::KC_4] = 4;
00026         OISKeyToGroupIndexMap[OIS::KC_5] = 5;
00027         OISKeyToGroupIndexMap[OIS::KC_6] = 6;
00028         OISKeyToGroupIndexMap[OIS::KC_7] = 7;
00029         OISKeyToGroupIndexMap[OIS::KC_8] = 8;
00030         OISKeyToGroupIndexMap[OIS::KC_9] = 9;
00031         return;
00032 }
00033 
00034 
00035 OgreGFX::ControlGroupsHandler::~ControlGroupsHandler(){
00036 }
00037 
00038 void OgreGFX::ControlGroupsHandler::checkHandleControlGroupKeys(bool ctrlDown, OIS::KeyCode key){
00039 
00040         switch (key) {
00041         case OIS::KC_0:
00042         case OIS::KC_1:
00043         case OIS::KC_2:
00044         case OIS::KC_3:
00045         case OIS::KC_4:
00046         case OIS::KC_5:
00047         case OIS::KC_6:
00048         case OIS::KC_7:
00049         case OIS::KC_8:
00050         case OIS::KC_9:
00051                 DEBUG(std::cout << "Handling control key : " << key << ", " << this->OISKeyToGroupIndexMap[key] << std::endl;)
00052                 if (ctrlDown){
00053                         createControlGroup(this->OISKeyToGroupIndexMap[key]);
00054                 } else {
00055                         selectControlGroup(this->OISKeyToGroupIndexMap[key]);
00056                 }
00057                 break;
00058         default:
00059                 //do nothing
00060                 break;
00061         }
00062 
00063 
00064 }
00065 
00066 void OgreGFX::ControlGroupsHandler::createControlGroup(int mkey){
00067         groups[mkey].clear();
00068         for(std::list<OgreGFX::GFXNode *>::iterator it = this->gfx->uiMgr->currentSelections.begin();
00069                                 it != this->gfx->uiMgr->currentSelections.end(); ++it){
00070                 groups[mkey].push_back(*it);
00071         }
00072         gfx->uiMgr->printCurrentSelections();
00073 }
00074 
00075 
00076 void OgreGFX::ControlGroupsHandler::selectControlGroup(int mkey){
00077 
00078         this->gfx->uiMgr->clearSelectionsAndUpdateFEEngine();
00079         for(std::list<OgreGFX::GFXNode *>::iterator it = this->groups[mkey].begin();
00080                                 it != this->groups[mkey].end(); ++it){
00081                 this->gfx->uiMgr->currentSelections.push_back(*it);
00082         }
00083         gfx->uiMgr->printCurrentSelections();
00084         this->gfx->uiMgr->updateFEEngineWithSelections();
00085 
00086 
00087 
00088 }
00089 

Generated on Fri Dec 13 14:54:17 2013 for FastECSLent by  doxygen 1.5.4