After rolling the stone, i get to this code that handles fine loading Listbox, mixing concepts from Demo6,preview posts, and ogre forum help.
Code: Select all
ConfigOptionMap m_system_caps;
m_system_caps = this->mRoot->getRenderSystem()->getConfigOptions();
CEGUI::ListboxTextItem *list_box_item;
Ogre::ConfigOptionMap::iterator itr = m_system_caps.begin();
while(itr != m_system_caps.end())
{
if((itr)->first == "Video Mode")
{
Ogre::StringVector possible_values = (itr)->second.possibleValues;
Ogre::StringVector::iterator pv_itr = possible_values.begin();
while(pv_itr != possible_values.end())
{
list_box_item = new CEGUI::ListboxTextItem((*pv_itr));
static_cast<Combobox*>(WindowManager::getSingleton().getWindow("options/ResOptions"))->addItem(list_box_item);
pv_itr ++;
}
}
itr ++;
}
Now i've managed to setconfig specific values, but i'm getting stuck again trying to get selection from combobox itemvalues on ApplyButton handle.
Code: Select all
bool handleOk(const CEGUI::EventArgs& e)
{
using namespace Ogre; // <-- ultimate in lazy
RenderSystemList *rsList = mRoot->getAvailableRenderers();
int c=0;
bool foundit = false;
RenderSystem *selectedRenderSystem=0;
while(c < (int) rsList->size())
{
selectedRenderSystem = rsList->at(c);
String rname = selectedRenderSystem->getName();
if(rname.compare("Direct3D9 Rendering Subsystem")==0)
{
foundit=true;
break;
}
c++; // <-- oh how clever
}
if(!foundit) return 0; //we didn't find it...
selectedRenderSystem->setConfigOption("Video Mode", (list_box_item * CEGUI::Combobox::getSelectedItem("options/ResOptions"));
/* Help file
ListboxItem * CEGUI::Combobox::getSelectedItem ( void ) const
Return a pointer to the currently selected item. */
//selectedRenderSystem->setConfigOption("Video Mode", "800 x 600 @ 32-bit colour"); // That works
mRoot->saveConfig();
return true;
}
};
How should i handle setconfig to store comboboxitem selected?
