Black'Tea
08-03-2008 16:08:58
Is there a way to display the progressbar vertically?
edit: and how to set a texture for the progressbar?
edit: and how to set a texture for the progressbar?
Black'Tea
08-03-2008 16:08:58
kungfoomasta
08-03-2008 19:14:43
Black'Tea
08-03-2008 19:35:01
kungfoomasta
08-03-2008 22:09:01
Black'Tea
09-03-2008 12:30:47
bool QuickGuiManager::IsProgressBarthere(Ogre::String Name)
{
QuickGUI::ProgressBar* pgb = NULL;
pgb = static_cast<QuickGUI::ProgressBar*>(mGameSheet->getChildWidget(Name));
if (pgb == NULL)
return false;
if (pgb != NULL)
return true;
}
kungfoomasta
09-03-2008 18:07:39
Black'Tea
12-03-2008 18:20:05
Ogre::LogManager::getSingleton().logMessage("IsProgressBarthere");
Ogre::LogManager::getSingleton().logMessage(Name);
QuickGUI::ProgressBar* pgb = NULL;
pgb = static_cast<QuickGUI::ProgressBar*>(mGameSheet->findChildWidget(Name));
if (pgb == NULL)
{
Ogre::LogManager::getSingleton().logMessage("ProgressBar is not available!");
return false;
}
if (pgb != NULL)
{
Ogre::LogManager::getSingleton().logMessage("ProgressBar is available!");
return true;
}
Ogre::LogManager::getSingleton().logMessage("IsProgressBarthere END");
return false;
kungfoomasta
12-03-2008 20:09:59
Black'Tea
13-03-2008 14:30:21
kungfoomasta
13-03-2008 16:42:48
- Changed getChildWidget to findChildWidget which searches recursively for a child
- Added getChildWidget which only looks for a child among it's children.
Black'Tea
13-03-2008 17:28:09
void QuickGuiManager::AddProgressBar(Ogre::String Name, Ogre::String tex, float x, float y, float width, float height)
{
QuickGUI::ProgressBar* pgb = mGameSheet->createProgressBar(Name);
pgb->setPosition( mRoot->mCamera->getViewport()->getActualWidth() * x,
mRoot->mCamera->getViewport()->getActualHeight() * y);
pgb->setWidth( mRoot->mCamera->getViewport()->getActualWidth() * width);
pgb->setHeight( mRoot->mCamera->getViewport()->getActualHeight() * height);
pgb->setClippingEdge(QuickGUI::ProgressBar::ClippingEdge::CLIP_LEFT_BOTTOM);
pgb->setFillDirection(QuickGUI::ProgressBar::FillDirection::FILLS_NEGATIVE_TO_POSITIVE);
pgb->setInitialPixelOffset(0);
pgb->setProgress(1.0f);
pgb->show();
}
void QuickGuiManager::SetupHighscore(bool background)
{
mGUI->getMouseCursor()->show();
/*...*/
mHighscoreSheet = mGUI->createSheet();
/*...*/
//Backgroundwindow
mHighscoreWindow = mHighscoreSheet->createWindow();
mHighscoreWindow->setPosition(mRoot->mCamera->getViewport()->getActualWidth() * 0.2,
mRoot->mCamera->getViewport()->getActualHeight() * 0.2);
mHighscoreWindow->setWidth(mRoot->mCamera->getViewport()->getActualWidth() * 0.6);
mHighscoreWindow->setHeight(mRoot->mCamera->getViewport()->getActualHeight() * 0.6);
mHighscoreWindow->show();
mHighscoreWindow->hideSkin();
mHighscoreWindow->hideTitlebar();
/*...*/
QuickGUI::Label* MainLabel = mHighscoreWindow->createLabel();
MainLabel->setPosition(mHighscoreWindow->getWidth() * 0.2,
mHighscoreWindow->getHeight() * 0.07 );
MainLabel->setWidth( mHighscoreWindow->getWidth() * 0.6);
MainLabel->setHeight( mHighscoreWindow->getHeight() * 0.1);
MainLabel->setFont(Cache::Instance().mRoot->mSettings.Menu);
MainLabel->setTextColor(Cache::Instance().mRoot->mSettings.MenuC);
MainLabel->setText("Highscore");
MainLabel->setTextBounds(QuickGUI::Point(0,0),QuickGUI::Size(MainLabel->getWidth(),MainLabel->getHeight()));
MainLabel->show();
MainLabel->hideSkin();
for (int i=0;i<10;i++)
{
QuickGUI::Label* Label = mHighscoreWindow->createLabel();
Label->setPosition(mHighscoreWindow->getWidth() * 0.1,
mHighscoreWindow->getHeight() * 0.2 + mHighscoreWindow->getHeight() * (0.65 * i / 10));
Label->setWidth( mHighscoreWindow->getWidth() * 0.3);
Label->setHeight( mHighscoreWindow->getHeight() * 0.08);
Label->setFont(Cache::Instance().mRoot->mSettings.Menu);
Label->setText(iNames->c_str());
Label->setTextColor(Cache::Instance().mRoot->mSettings.MenuC);
Label->setTextBounds(QuickGUI::Point(0,0),QuickGUI::Size(Label->getWidth(),Label->getHeight()));
Label->show();
Label->hideSkin();
QuickGUI::Label* Label2 = mHighscoreWindow->createLabel();
Label2->setPosition(mHighscoreWindow->getWidth() * 0.6,
mHighscoreWindow->getHeight() * 0.2 + mHighscoreWindow->getHeight() * (0.65 * i / 10));
Label2->setWidth( mHighscoreWindow->getWidth() * 0.3);
Label2->setHeight( mHighscoreWindow->getHeight() * 0.08);
Label2->setFont(Cache::Instance().mRoot->mSettings.Menu);
Label2->setText(iPoints->c_str());
Label2->setTextColor(Cache::Instance().mRoot->mSettings.MenuC);
Label2->setTextBounds(QuickGUI::Point(0,0),QuickGUI::Size(Label2->getWidth(),Label2->getHeight()));
Label2->show();
Label2->hideSkin();
iPoints++;
iNames++;
}
QuickGUI::Button* BhighscoreEND = mHighscoreWindow->createButton("Highscore");
BhighscoreEND->setPosition(mHighscoreWindow->getWidth() * 0.4,
mHighscoreWindow->getHeight() * 0.88);
BhighscoreEND->setWidth( mHighscoreWindow->getWidth() * 0.2);
BhighscoreEND->setHeight( mHighscoreWindow->getHeight() * 0.08);
BhighscoreEND->setText("Ok");
BhighscoreEND->addEventHandler(QuickGUI::Widget::EVENT_MOUSE_CLICK,&QuickGuiManager::SetupMenu,this);
BhighscoreEND->setTextBounds(QuickGUI::Point(0,0),QuickGUI::Size(BhighscoreEND->getWidth(),BhighscoreEND->getHeight()));
BhighscoreEND->setFont(Cache::Instance().mRoot->mSettings.Menu);
BhighscoreEND->setTextColor(Cache::Instance().mRoot->mSettings.MenuC);
BhighscoreEND->show();
BhighscoreEND->hideSkin();
mGUI->setActiveSheet(mHighscoreSheet);
if (background == false) // some game specific ...
{
mGameSheet->removeAndDestroyAllChildWidgets();
mGUI->destroySheet(mGameSheet);
}
}
kungfoomasta
13-03-2008 18:01:23
mGameSheet->removeAndDestroyAllChildWidgets();
Black'Tea
13-03-2008 20:41:00
mGameSheet->removeAndDestroyAllChildWidgets();
This would remove the Progress Bar. I made this mistake in my own project. Ideally each game state will have its own sheet, and you can just make the call to "mGUIManager->setActiveSheet(mySheet1);" whenever you need to switch sheets.
kungfoomasta
14-03-2008 05:14:19
Black'Tea
14-03-2008 13:02:08
mGameSheet->removeAndDestroyAllChildWidgets();
bool QuickGuiManager::IsProgressBarthere(Ogre::String Name)
{
QuickGUI::ProgressBar* pgb = NULL;
pgb = static_cast<QuickGUI::ProgressBar*>(mGameSheet->findChildWidget(Name));
if (pgb == NULL)
{
Ogre::LogManager::getSingleton().logMessage("ProgressBar isn´t available!");
return false;
}
if (pgb != NULL)
{
Ogre::LogManager::getSingleton().logMessage("ProgressBar is available!");
return true;
}
return false;
}
static_cast<QuickGUI::ProgressBar*>(mGameSheet->findChildWidget(Name));
bool QuickGuiManager::IsProgressBarthere(Ogre::String Name)
{
if (mGameSheet->isChild(static_cast<QuickGUI::ProgressBar*>(mGameSheet->getChildWidget(Name))) == true)
return true;
return false;
}
kungfoomasta
14-03-2008 18:18:53