Esempio n. 1
0
MenuShell::MenuShell(PlayerData& playerData) : activeState(NULL)
{
   try
   {
      setWidth(GraphicsUtil::getInstance()->getWidth());
      setHeight(GraphicsUtil::getInstance()->getHeight());

      const gcn::Color menuBackgroundColor(50, 50, 50, 150);
      const gcn::Rectangle menuAreaRect(0, 0, getWidth() * 0.8 - 5, getHeight() - 10);

      bg = new gcn::Icon("data/images/menubg.jpg");
      selectSound = ResourceLoader::getSound("reselect");

      menuTabs = new edwt::TabbedArea();
      menuArea = new edwt::Container();
      menuArea->setDimension(menuAreaRect);
      menuArea->setOpaque(false);

      menuTabs->setDimension(menuAreaRect);
      menuTabs->setForegroundColor(0xFFFFFF);
      menuTabs->setBaseColor(menuBackgroundColor);
      menuTabs->setDimension(menuAreaRect);

      menuTabs->addTab("Party", menuArea);

      CharacterList party = playerData.getParty();
      for (CharacterList::iterator iter = party.begin(); iter != party.end(); ++iter)
      {
         menuTabs->addTab((*iter)->getName(), menuArea);
      }

      populateOpsList();
      actionsListBox = new edwt::ListBox(listOps);
      actionsListBox->setBaseColor(0xFFFFFF);
      actionsListBox->setMinWidth((getWidth() * 0.2) - 10);
      actionsListBox->setAlignment(edwt::RIGHT);
      actionsListBox->adjustSize();
      actionsListBox->adjustWidth();
      actionsListBox->setBackgroundColor(menuBackgroundColor);
      actionsListBox->setOpaque(false);
      actionsListBox->setRowPadding(5);
      actionsListBox->addActionListener(this);
      actionsListBox->addSelectionListener(this);

      add(bg);
      add(menuTabs, getWidth() * 0.2, 5);
      add(actionsListBox, 5, menuTabs->getTabHeight() + 5);
   }
   catch (gcn::Exception& e)
   {
      DEBUG(e.getMessage());
   }
}
Esempio n. 2
0
SaveGameModule::SaveGameModule(PlayerData& playerData) : playerData(playerData)
{
   setNumberOfColumns(PlayerData::PARTY_SIZE);
   setHorizontalSpacing(10);
   setPadding(5, 5, 5, 5);

   CharacterList party = playerData.getParty();
   for(CharacterList::iterator iter = party.begin(); iter != party.end(); ++iter)
   {
      edwt::Icon* characterPicture = new edwt::Icon((*iter)->getPortraitPath());

      add(characterPicture);
      characterPortraits.push_back(characterPicture);
   }
   
   adjustContent();
   setOpaque(false);
   
   addMouseListener(this);
}