widgetMgr.cpp

Go to the documentation of this file.
00001 /*
00002  * widgetMgr.cpp
00003  *
00004  *  Created on: Jan 7, 2013
00005  *      Author: sushil
00006  */
00007 
00008 
00009 #include <OISEvents.h>
00010 #include <OISInputManager.h>
00011 #include <OISKeyboard.h>
00012 #include <OISMouse.h>
00013 #include "DEBUG.h"
00014 #include "command.h"
00015 #include "enums.h"
00016 #include "flock.h"
00017 #include "commandHelp.h"
00018 
00019 #include <widgetMgr.h>
00020 
00021 #include <GraphicsInteractionManager.h>
00022 
00023 OgreGFX::WidgetMgr::WidgetMgr(GraphicsInteractionManager *gim) : GFXMgr(gim), Ogre::FrameListener(), Ogre::WindowEventListener(), OIS::KeyListener(), OIS::MouseListener()
00024 {
00025     DEBUG(std::cout << "Creating Widget Manager" << std::endl;)
00026     nextId = 0;
00027 
00028     //Defaults
00029     this->gfx->mWindow->getWidth();
00030     POS = Ogre::Vector2(0, 0);
00031     LABEL_SIZE = Ogre::Vector2(100, 20);
00032     PANEL_SIZE = Ogre::Vector2(100, 20);
00033     MENU_ITEM_SIZE = Ogre::Vector2(100, 20);
00034     BUTTON_SIZE = Ogre::Vector2(0.0417f, 0.0417f);
00035     COMMANDPANEL_POS = Ogre::Vector2(0.7614583f, 0.825f);
00036     MENU_SIZE = Ogre::Vector2(0.2083f, 0.125f);
00037     MID_PANEL_POS = Ogre::Vector2(0.262f, 0.857f);
00038     MID_PANEL_SIZE = Ogre::Vector2(0.476f,0.019f);
00039 
00040     WIDTH = 100;
00041     HEIGHT = 20;
00042     LABEL_X_OFFSET = 5;
00043     LABEL_Y_OFFSET = 5;
00044 
00045     LABEL_TEXT_COLOR = Ogre::ColourValue(1.0, 1.0, 0.7, 1.0);
00046     BUTTON_OFF_TEXT_COLOR = Ogre::ColourValue(1.0, 1.0, 0.0, 1.0);
00047     BUTTON_ON_TEXT_COLOR = Ogre::ColourValue(0.0, 0.0, 0.5, 1.0);
00048     MENU_DEFAULT_TEXT_COLOR = Ogre::ColourValue(1.0, 1.0, 0.0, 1.0);
00049     MENU_SELECTED_TEXT_COLOR = Ogre::ColourValue(0.0, 0.0, 0.5, 1.0);
00050 
00051 
00052     PANEL_MATERIAL = "ECSLENT/navy/material/shipInfo/overlay";
00053     LINE_SEP_MATERIAL = "ECSLENT/line";
00054     MENU_MATERIAL = "ECSLENT/navy/material/rmenu";
00055 
00056     uiBase = 0;
00057     currMenu = NULL;
00058     //uiBase->show();
00059 
00060 
00061 
00062     DEBUG(std::cout << "Finished  Widget Manager: " << getNextId("Test") << std::endl;)
00063 }
00064 
00065 OgreGFX::WidgetMgr::~WidgetMgr()
00066 {
00067 }
00068 
00069 void OgreGFX::WidgetMgr::activateMenu(FastEcslent::Entity* ent)
00070 {
00071     this->deactivateMenu();
00072     switch (ent->entityType)
00073     {
00074     case FastEcslent::SCV:
00075         currMenu = scvMenu;
00076         break;
00077         case FastEcslent::HELLION:
00078             currMenu = multiMenu; //temp menu for testing
00079             break;
00080     case FastEcslent::COMMANDCENTER:
00081         currMenu = cmdcMenu;
00082         break;
00083     case FastEcslent::BARRACKS:
00084         currMenu = barracksMenu;
00085         break;
00086     case FastEcslent::FACTORY:
00087         currMenu = factoryMenu;
00088         break;
00089     case FastEcslent::NENTITYTYPES:
00090         currMenu = multiMenu;
00091         break;
00092     default:
00093         this->deactivateMenu();
00094         break;
00095     }
00096     //assign new menu to curmenu
00097 
00098     if (currMenu)
00099     {
00100         currMenu->show();
00101         unitName->textArea->setCaption(ent->uiname);
00102         buildProgressPanel->show();
00103         //unitHealth->textArea->setCaption(boost::to_string(ent->weapon->currentHitpoints) + "/" + boost::to_string(gfx->engine->gameMgr->entTypeData[ent->entityType].hitPoints));
00104     }
00105 
00106 }
00107 
00108 void OgreGFX::WidgetMgr::deactivateMenu()
00109 {
00110     if (currMenu)
00111     {
00112         currMenu->hide();
00113     }
00114     
00115     currMenu = NULL;
00116     //unitName->textArea->setCaption("");
00117     //unitHealth->textArea->setCaption("");
00118     buildProgressPanel->hide();
00119     buildProgressEmpty->percentFull = 0.0;
00120     
00121 }
00122 
00123 void OgreGFX::WidgetMgr::initialize()
00124 {
00125     Ogre::Vector2 relLabelSize(0.0595f, 0.019f);
00126     uiBase = new UIOutline(this->gfx);
00127     uiBase->overlay->setZOrder(0);
00128     uiBase->show();
00129     //uiBase->hide();
00130 
00131     testPanel = new OgreGFX::FEPanel(this->gfx, "TestPanel", (Widget*) 0, POS, PANEL_SIZE, PANEL_MATERIAL, Ogre::GMM_PIXELS);
00132 
00133     buttonInfo = new OgreGFX::FEPanel(this->gfx, "ButtonInfo", (Widget*) 0, Ogre::Vector2(0.7614583f, 0.6666), MENU_SIZE, MENU_MATERIAL, Ogre::GMM_RELATIVE);
00134     buildProgressPanel  = new OgreGFX::FEPanel(this->gfx, "TestPanel", (Widget*) 0, MID_PANEL_POS, MID_PANEL_SIZE, PANEL_MATERIAL, Ogre::GMM_RELATIVE);
00135     scvMenu = new OgreGFX::FEPanel(this->gfx, "SCVMenu", (Widget*) 0, COMMANDPANEL_POS, MENU_SIZE, MENU_MATERIAL, Ogre::GMM_RELATIVE);
00136     cmdcMenu = new OgreGFX::FEPanel(this->gfx, "CmdcMenu", (Widget*) 0, COMMANDPANEL_POS, MENU_SIZE, MENU_MATERIAL, Ogre::GMM_RELATIVE);
00137     barracksMenu = new OgreGFX::FEPanel(this->gfx, "barracksMenu", (Widget*) 0, COMMANDPANEL_POS, MENU_SIZE, MENU_MATERIAL, Ogre::GMM_RELATIVE);
00138     factoryMenu = new OgreGFX::FEPanel(this->gfx, "factoryMenu", (Widget*) 0, COMMANDPANEL_POS, MENU_SIZE, MENU_MATERIAL, Ogre::GMM_RELATIVE);
00139     multiMenu = new OgreGFX::FEPanel(this->gfx, "MultiMenu", (Widget*) 0, COMMANDPANEL_POS, MENU_SIZE, MENU_MATERIAL, Ogre::GMM_RELATIVE);
00140     std::set<OIS::KeyCode> *creationMods = new std::set<OIS::KeyCode > ();
00141     OIS::KeyCode attackCode = OIS::KC_A;
00142     OIS::KeyCode moveCode = OIS::KC_Y;
00143     OIS::KeyCode gatherCode = OIS::KC_G;
00144     OIS::KeyCode buildBarracksCode = OIS::KC_B;
00145     OIS::KeyCode buildFactoryCode = OIS::KC_F;
00146     OIS::KeyCode buildRefineryCode = OIS::KC_R;
00147     OIS::KeyCode buildSCVCode = OIS::KC_S;
00148     OIS::KeyCode buildMarineCode = OIS::KC_M;
00149     OIS::KeyCode buildHellionCode = OIS::KC_H;
00150     OIS::KeyCode placeholderCode = OIS::KC_UNASSIGNED;
00151     scvAtk = new OgreGFX::FEButton(this->gfx, attackCode, creationMods, OIS::MB_Left, "scvAtk", NULL,
00152                                    scvMenu, POS, BUTTON_SIZE, "Attack", "Attack", Ogre::GMM_RELATIVE);
00153     scvBuildFactory = new OgreGFX::FEButton(this->gfx, buildFactoryCode, creationMods, OIS::MB_Left, "scvFactory", new FastEcslent::BuildStructureFactory(FastEcslent::FACTORY, "Factory.mesh"),
00154                                    scvMenu, POS, BUTTON_SIZE, "FactoryPanel", "Build a Factory", Ogre::GMM_RELATIVE);
00155     scvBuildRefinery = new OgreGFX::FEButton(this->gfx, buildRefineryCode, creationMods, OIS::MB_Left, "scvRefinery", new FastEcslent::BuildStructureFactory(FastEcslent::REFINERY, "Refinery.mesh", FastEcslent::TargetEntity, FastEcslent::GAS),
00156                                    scvMenu, POS, BUTTON_SIZE, "RefineryPanel", "Build a Refinery on an Oil Field", Ogre::GMM_RELATIVE);
00157     scvBuildBarracks = new OgreGFX::FEButton(this->gfx, buildBarracksCode, creationMods, OIS::MB_Left, "scvBarracks", new FastEcslent::BuildStructureFactory(FastEcslent::BARRACKS, "Barracks.mesh"),
00158                                    scvMenu, POS, BUTTON_SIZE, "BarracksPanel", "Build a Barracks", Ogre::GMM_RELATIVE);
00159     scvMove = new OgreGFX::FEButton(this->gfx, moveCode, creationMods, OIS::MB_Left, "scvMove", new FastEcslent::MoveFactory(),
00160                                    scvMenu, POS, BUTTON_SIZE, "Move", "Move unit", Ogre::GMM_RELATIVE);
00161     scvGather = new OgreGFX::FEButton(this->gfx, gatherCode, creationMods, OIS::MB_Left, "scvGather", NULL,
00162                                    scvMenu, POS, BUTTON_SIZE, "Gather", "Gather Resources", Ogre::GMM_RELATIVE);
00163     cmdcBuildSCV = new OgreGFX::FEButton(this->gfx, buildSCVCode, creationMods, OIS::MB_Left, "cmdcBuildSCV", new FastEcslent::BuildFactory(FastEcslent::SCV),
00164                                    cmdcMenu, POS, BUTTON_SIZE, "Boats/SCV", "Build SCV", Ogre::GMM_RELATIVE);
00165     multiAtk = new OgreGFX::FEButton(this->gfx, attackCode, creationMods, OIS::MB_Left, "multiAtk", NULL,
00166                                    multiMenu, POS, BUTTON_SIZE, "Attack", "Attack", Ogre::GMM_RELATIVE);
00167     multiMove = new OgreGFX::FEButton(this->gfx,moveCode, creationMods, OIS::MB_Left, "multiMove", NULL,
00168                                    multiMenu, POS, BUTTON_SIZE, "Move", "Move Units", Ogre::GMM_RELATIVE);
00169     barracksMarine = new OgreGFX::FEButton(this->gfx,buildMarineCode, creationMods, OIS::MB_Left, "barracksMarine", new FastEcslent::BuildFactory(FastEcslent::MARINE),
00170                                    barracksMenu, POS, BUTTON_SIZE, "Boats/MARINE", "Build a Marine", Ogre::GMM_RELATIVE);
00171     factoryBuildVulture = new OgreGFX::FEButton(this->gfx,buildHellionCode, creationMods, OIS::MB_Left, "factoryVulture", new FastEcslent::BuildFactory(FastEcslent::HELLION),
00172                                    barracksMenu, POS, BUTTON_SIZE, "Boats/VULTURE", "Build a Vulture", Ogre::GMM_RELATIVE);
00173     buildQueueItem1 = new OgreGFX::FEButton(this->gfx,placeholderCode, creationMods, OIS::MB_Left, "buildQueueItem1", NULL,
00174                                    buildProgressPanel, POS, BUTTON_SIZE, "Action1", "buildQueueItem1", Ogre::GMM_RELATIVE);
00175     buildQueueItem2 = new OgreGFX::FEButton(this->gfx,placeholderCode, creationMods, OIS::MB_Left, "buildQueueItem2", NULL,
00176                                    buildProgressPanel, POS, BUTTON_SIZE, "Action2", "buildQueueItem2", Ogre::GMM_RELATIVE);
00177     buildQueueItem3 = new OgreGFX::FEButton(this->gfx,placeholderCode, creationMods, OIS::MB_Left, "buildQueueItem3", NULL,
00178                                    buildProgressPanel, POS, BUTTON_SIZE, "Action3", "buildQueueItem3", Ogre::GMM_RELATIVE);
00179     buildQueueItem4 = new OgreGFX::FEButton(this->gfx,placeholderCode, creationMods, OIS::MB_Left, "buildQueueItem4", NULL,
00180                                    buildProgressPanel, POS, BUTTON_SIZE, "Action4", "buildQueueItem4", Ogre::GMM_RELATIVE);
00181     buildQueueItem5 = new OgreGFX::FEButton(this->gfx,placeholderCode, creationMods, OIS::MB_Left, "buildQueueItem5", NULL,
00182                                    buildProgressPanel, POS, BUTTON_SIZE, "Action5", "buildQueueItem5", Ogre::GMM_RELATIVE);
00183     buildProgressEmpty = new OgreGFX::FEProgressBar(this->gfx, "ProgressBar", buildProgressPanel, POS, relLabelSize, "white","green",  Ogre::GMM_RELATIVE);
00184     buildQueueItems.push_back(buildQueueItem1);
00185     buildQueueItems.push_back(buildQueueItem2);
00186     buildQueueItems.push_back(buildQueueItem3);
00187     buildQueueItems.push_back(buildQueueItem4);
00188     buildQueueItems.push_back(buildQueueItem5);
00189     
00190 //    buildSCV = new OgreGFX::FEButton(this->gfx, creationMods, OIS::MB_Left, "NEWB", new FastEcslent::BuildFactory(FastEcslent::SCV),
00191 //                                   cmdcMenu, POS, BUTTON_SIZE, "Attack", "NTEST", Ogre::GMM_RELATIVE);
00192     this->gfx->uiMgr->registerMouseHandler(creationMods, OIS::MB_Left, scvAtk);
00193     this->gfx->uiMgr->registerMouseHandler(creationMods, OIS::MB_Left, scvMove);
00194     this->gfx->uiMgr->registerMouseHandler(creationMods, OIS::MB_Left, scvGather);
00195     this->gfx->uiMgr->registerMouseHandler(creationMods, OIS::MB_Left, scvBuildFactory);
00196     this->gfx->uiMgr->registerMouseHandler(creationMods, OIS::MB_Left, scvBuildRefinery);
00197     this->gfx->uiMgr->registerMouseHandler(creationMods, OIS::MB_Left, scvBuildBarracks);
00198     this->gfx->uiMgr->registerMouseHandler(creationMods, OIS::MB_Left, cmdcBuildSCV);
00199     this->gfx->uiMgr->registerMouseHandler(creationMods, OIS::MB_Left, multiAtk);
00200     this->gfx->uiMgr->registerMouseHandler(creationMods, OIS::MB_Left, multiMove);
00201     this->gfx->uiMgr->registerMouseHandler(creationMods, OIS::MB_Left, barracksMarine);
00202     this->gfx->uiMgr->registerMouseHandler(creationMods, OIS::MB_Left, factoryBuildVulture);
00203     this->gfx->uiMgr->registerKeyHandler(creationMods, buildBarracksCode, scvBuildBarracks);
00204     this->gfx->uiMgr->registerKeyHandler(creationMods, buildFactoryCode, scvBuildFactory);
00205     this->gfx->uiMgr->registerKeyHandler(creationMods, buildRefineryCode, scvBuildRefinery);
00206     this->gfx->uiMgr->registerKeyHandler(creationMods, moveCode, scvMove);
00207     this->gfx->uiMgr->registerKeyHandler(creationMods, attackCode, scvAtk);
00208     this->gfx->uiMgr->registerKeyHandler(creationMods, gatherCode, scvGather);
00209     this->gfx->uiMgr->registerKeyHandler(creationMods, buildSCVCode, cmdcBuildSCV);
00210     this->gfx->uiMgr->registerKeyHandler(creationMods, attackCode, multiAtk);
00211     this->gfx->uiMgr->registerKeyHandler(creationMods, moveCode, multiMove);
00212     this->gfx->uiMgr->registerKeyHandler(creationMods, buildMarineCode, barracksMarine);
00213     this->gfx->uiMgr->registerKeyHandler(creationMods, buildHellionCode, factoryBuildVulture);
00214     //this->gfx->uiMgr->registerMouseHandler(creationMods, OIS::MB_Left, buildSCV);
00215 
00216     scvMenu->addItem(scvAtk, Below);
00217     scvMenu->addItem(scvMove, Right);
00218     scvMenu->addItem(scvGather, Right);
00219     scvMenu->addItem(scvBuildFactory, Below);
00220     scvMenu->addItem(scvBuildBarracks, Right);
00221     scvMenu->addItem(scvBuildRefinery, Below);
00222     cmdcMenu->addItem(cmdcBuildSCV, Below);
00223     //cmdcMenu->addItem(buildSCV, Right);
00224     multiMenu->addItem(multiAtk, Below);
00225     multiMenu->addItem(multiMove, Right);
00226     barracksMenu->addItem(barracksMarine, Below);
00227     factoryMenu->addItem(factoryBuildVulture, Below);
00228 
00229 
00230     unitName = new OgreGFX::FELabel(this->gfx, "unitName", buildProgressPanel, LABEL_TEXT_COLOR, POS, relLabelSize+Ogre::Vector2(0.12f,0), Ogre::GMM_RELATIVE);
00231     unitHealth = new OgreGFX::FELabel(this->gfx, "unitHealth", buildProgressPanel, LABEL_TEXT_COLOR, POS, relLabelSize, Ogre::GMM_RELATIVE);
00232     testLabel = new OgreGFX::FELabel(this->gfx, "TestLabel", testPanel, LABEL_TEXT_COLOR, POS, LABEL_SIZE, Ogre::GMM_PIXELS);
00233     testLabel2 = new OgreGFX::FELabel(this->gfx, "SecondRow", testPanel, LABEL_TEXT_COLOR, POS, LABEL_SIZE, Ogre::GMM_PIXELS);
00234     buttonDesc = new OgreGFX::FELineWrapLabel(this->gfx, "ButtonDesc", buttonInfo, LABEL_TEXT_COLOR, POS, MENU_SIZE, Ogre::GMM_RELATIVE, 6);
00235     //buttonDesc->textArea->setCharHeight(buttonDesc->size.y / 4.0);
00236     buildProgressPanel->addItem(unitName, Below);
00237     buildProgressPanel->addItem(unitHealth,Right);
00238     buildProgressPanel->addItem(buildProgressEmpty,Below);
00239     buildProgressPanel->addItem(buildQueueItem1,Below);
00240     buildProgressPanel->addItem(buildQueueItem2,Right);
00241     buildProgressPanel->addItem(buildQueueItem3,Right);
00242     buildProgressPanel->addItem(buildQueueItem4,Right);
00243     buildProgressPanel->addItem(buildQueueItem5,Right);
00244     
00245     testPanel->addItem(testLabel, Below);
00246     testPanel->addItem(testLabel2, Below);
00247     buttonDesc->setCaption("Test");
00248     buttonInfo->addItem(buttonDesc,Below);
00249     //buildProgressPanel->addItem(buttonDesc,Below);
00250     buildProgressPanel->show();
00251     unitName->show();
00252     unitHealth->show();
00253     buildProgressEmpty->show();
00254     buttonDesc->show();
00255     testLabel2->show();
00256     testLabel->show();
00257     testPanel->show();
00258     buttonInfo->hide();
00259     buildProgressPanel->hide();
00260     scvMenu->hide();
00261     cmdcMenu->hide();
00262     multiMenu->hide();
00263     barracksMenu->hide();
00264     factoryMenu->hide();
00265 
00266     testLabelPair = new OgreGFX::FELabelPair(this->gfx, "NewKey", "NewValue", testPanel,
00267                                              LABEL_TEXT_COLOR,
00268                                              Ogre::Vector2(1000, 0), Ogre::Vector2(100, 200), 20, PANEL_MATERIAL, Ogre::GMM_PIXELS);
00269     testLabelPair2 = new OgreGFX::FELabelPair(this->gfx, "Name", "Value2", testPanel,
00270                                               LABEL_TEXT_COLOR,
00271                                               Ogre::Vector2(1000, 0), Ogre::Vector2(100, 200), 20, PANEL_MATERIAL, Ogre::GMM_PIXELS);
00272     testPanel->addItem(testLabelPair, Below);
00273     testPanel->addItem(testLabelPair2, Below);
00274     testLabelPair->show();
00275     first = true;
00276     //creationMods->insert(OIS::KC_LCONTROL);
00277 }
00278 
00279 bool OgreGFX::WidgetMgr::frameStarted(const Ogre::FrameEvent& evt)
00280 {
00281     return true;
00282 }
00283 
00284 bool OgreGFX::WidgetMgr::frameEnded(const Ogre::FrameEvent& evt)
00285 {
00286     return true;
00287 }
00288 
00289 bool OgreGFX::WidgetMgr::frameRenderingQueued(const Ogre::FrameEvent& evt)
00290 {
00291     std::string gasLabel = "     Gas: ";
00292     std::string mineralsLabel = "Minerals: ";
00293     DEBUG(std::cout << "Setting caption" << std::endl;)
00294     if (first)
00295     {
00296         //first = false;
00297         //--------------------------------------------------------------------------
00298         //testLabel->textArea->setCaption(testLabel->caption);
00299         gasLabel.append(boost::lexical_cast<std::string > (this->gfx->engine->gameMgr->resources[gfx->engine->options.player].gas));
00300         mineralsLabel.append(boost::lexical_cast<std::string > (this->gfx->engine->gameMgr->resources[gfx->engine->options.player].minerals));
00301         testLabel->textArea->setCaption(gasLabel);
00302         testLabel2->textArea->setCaption(mineralsLabel);
00303         //unitName->textArea->setCaption("TEST NAME");
00304         //unitHealth->textArea->setCaption("TEST HEALTH");
00305         testLabelPair->setLeft(testLabelPair->left->caption);
00306         testLabelPair->setRight(testLabelPair->right->caption);
00307 
00308         testLabelPair2->setLeft(testLabelPair2->left->caption);
00309         testLabelPair2->setRight(testLabelPair2->right->caption);
00310         buttonDesc->textArea->setCaption(buttonDesc->caption);
00311         
00312         buildProgressEmpty->percentFull = 0;
00313         buildQueueItem1->material ="Action1";
00314         buildQueueItem2->material ="Action2";
00315         buildQueueItem3->material ="Action3";
00316         buildQueueItem4->material ="Action4";
00317         buildQueueItem5->material ="Action5";
00318         std::vector<FEButton*>::iterator buildIcon = buildQueueItems.begin();
00319         if(gfx->engine->selectionMgr->getPrimarySelection() != NULL)
00320         {
00321             unitHealth->textArea->setCaption(boost::to_string(gfx->engine->selectionMgr->getPrimarySelection()->hitpoints) + "/" + boost::to_string(gfx->engine->weaponMgr->maxHitpoints[gfx->engine->selectionMgr->getPrimarySelection()->entityType]));
00322             if(gfx->engine->selectionMgr->getPrimarySelection()->builder!= NULL && gfx->engine->selectionMgr->getPrimarySelection()->builder->entityBeingBuilt != NULL)
00323             {
00324                 buildProgressEmpty->percentFull = 1.0f - (gfx->engine->selectionMgr->getPrimarySelection()->builder->entityBeingBuilt->timeLeftToBirth / gfx->engine->gameMgr->entTypeData[gfx->engine->selectionMgr->getPrimarySelection()->builder->entityBeingBuilt->entityType].buildTime);
00325                 for(std::deque<FastEcslent::EntityType>::iterator it = gfx->engine->selectionMgr->getPrimarySelection()->builder->entityQueue.begin(); it != gfx->engine->selectionMgr->getPrimarySelection()->builder->entityQueue.end() && it != gfx->engine->selectionMgr->getPrimarySelection()->builder->entityQueue.begin()+5; it++)
00326                 {
00327                         (*buildIcon)->material = FastEcslent::EntityTypeToIconName(*it);
00328                         buildIcon++;
00329                 }
00330                 
00331             }
00332         }
00333 
00334         for(std::vector<FEButton*>::iterator it = buildQueueItems.begin(); it != buildQueueItems.end(); it++)
00335         {
00336             (*it)->panel->setMaterialName((*it)->material);
00337         }
00338         //buildQueueItem1->panel->setMaterialName(buildQueueItem1->material);
00339         buildProgressEmpty->UpdateFillPercent();
00340 //        scvAtk->textArea->setCaption(scvAtk->caption);
00341 //        scvMove->textArea->setCaption(scvMove->caption);
00342 //        scvGather->textArea->setCaption(scvGather->caption);
00343 //        cmdcBuildSCV->textArea->setCaption(cmdcBuildSCV->caption);
00344 //        multiAtk->textArea->setCaption(multiAtk->caption);
00345 //        multiMove->textArea->setCaption(multiMove->caption);
00346 //        barracksMarine->textArea->setCaption(barracksMarine->caption);
00347         //--------------------------------------------------------------------------
00348     }
00349     return true;
00350 }
00351 
00352 bool OgreGFX::WidgetMgr::keyPressed(const OIS::KeyEvent &arg)
00353 {
00354     DEBUG(std::cout << "Widget Manager key pressed: " << arg.key << std::endl;)
00355     return true;
00356 }
00357 
00358 bool OgreGFX::WidgetMgr::keyReleased(const OIS::KeyEvent &arg)
00359 {
00360     return true;
00361 }
00362 
00363 bool OgreGFX::WidgetMgr::mouseMoved(const OIS::MouseEvent &arg)
00364 {
00365     return true;
00366 }
00367 
00368 bool OgreGFX::WidgetMgr::mousePressed(const OIS::MouseEvent &arg, OIS::MouseButtonID id)
00369 {
00370     return true;
00371 }
00372 
00373 bool OgreGFX::WidgetMgr::mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id)
00374 {
00375     return true;
00376 }
00377 
00378 std::string OgreGFX::WidgetMgr::getNextId(std::string base)
00379 {
00380     std::stringstream idStream;
00381     this->nextId++;
00382     idStream << base << "_" << nextId;
00383     return idStream.str();
00384 }
00385 
00386 bool OgreGFX::WidgetMgr::mouseOverOverlay(const OIS::MouseEvent& arg)
00387 {
00388     if (scvMenu->cursonInMe(Ogre::Vector2(arg.state.X.abs, arg.state.Y.abs)))
00389         return true;
00390     return false;
00391 }
00392 
00393 bool OgreGFX::WidgetMgr::mouseOverButton(const OIS::MouseEvent& arg)
00394 {
00395     if (currMenu)
00396     {
00397         for(std::list<Widget*>::iterator it = currMenu->items.begin(); it != currMenu->items.end(); it++)
00398         {
00399             if((*it)->cursonInMe(Ogre::Vector2(arg.state.X.abs, arg.state.Y.abs)))
00400             {
00401                 buttonDesc->setCaption((*it)->desc);
00402                 buttonDesc->textArea->setCaption(buttonDesc->caption);
00403                 buttonInfo->show();
00404                 buildProgressPanel->show();
00405                 return true;
00406             }
00407         }
00408     }
00409     buttonInfo->hide();
00410     //buildProgressPanel->hide();
00411     buttonDesc->setCaption("ERROR");
00412     buttonDesc->textArea->setCaption(buttonDesc->caption);
00413     return false;
00414 }

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