本文整理汇总了C++中DataManager::getDimensions方法的典型用法代码示例。如果您正苦于以下问题:C++ DataManager::getDimensions方法的具体用法?C++ DataManager::getDimensions怎么用?C++ DataManager::getDimensions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataManager
的用法示例。
在下文中一共展示了DataManager::getDimensions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleDSActivation
bool GUIManager::handleDSActivation ( CEGUI::EventArgs const & e )
{
CEGUI::Window *tab =
static_cast<CEGUI::WindowEventArgs const &>(e).window->getParent();
CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
ListboxItem *item = static_cast<ListboxItem *>(lb->getFirstSelectedItem());
if (item != NULL) {
DataManager *dm = static_cast<DataManager *>(item->getUserData());
CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
std::vector<unsigned int> const & dims = dm->getDimensions();
unsigned int dim = dims[int(sb->getScrollPosition()*(dims.size()-1))];
float scrollPos = sb->getScrollPosition();
dm->activate(dim);
// Enable global scrollbar
CEGUI::WindowManager & wm = CEGUI::WindowManager::getSingleton();
sb = static_cast<CEGUI::Scrollbar *>(wm.getWindow("Sheet/DimensionSlider"));
sb->enable();
CEGUI::WindowEventArgs w(sb);
sb->fireEvent(CEGUI::Scrollbar::EventScrollPositionChanged, w);
// Set the global scrollbar to the right position.
sb->setScrollPosition(scrollPos);
CEGUI::Window *desc = wm.getWindow("Sheet/DimensionText");
desc->show();
}
// TODO handle else-error
return true;
}
示例2: handleDSSelection
bool GUIManager::handleDSSelection ( CEGUI::EventArgs const & e )
{
CEGUI::Window *tab =
static_cast<CEGUI::WindowEventArgs const &>(e).window->getParent();
CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
DataManager *dm = static_cast<DataManager *>(
lb->getFirstSelectedItem()->getUserData());
_selectedDM = dm;
std::vector<unsigned int> const & dim = dm->getDimensions();
sb->setStepSize(1.0/float(dim.size()-1));
sb->enable();
CEGUI::WindowEventArgs w(sb);
sb->fireEvent(CEGUI::Scrollbar::EventScrollPositionChanged, w);
return true;
}
示例3: handleScrollbarChanged
bool GUIManager::handleScrollbarChanged ( CEGUI::EventArgs const & e )
{
CEGUI::Window *tab =
static_cast<CEGUI::WindowEventArgs const &>(e).window->getParent();
CEGUI::Scrollbar *scrollbar =
static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
CEGUI::Window *desc = tab->getChild(1);
DataManager *dm = static_cast<DataManager *>(
lb->getFirstSelectedItem()->getUserData());
std::vector<unsigned int> const & dims = dm->getDimensions();
float f = static_cast<CEGUI::Scrollbar *>(scrollbar)->getScrollPosition();
unsigned int dim = dims[int(f*(dims.size()-1))];
std::ostringstream ss; ss << "Dimension: " << dim;
desc->setText(ss.str());
return true;
}