本文整理汇总了C++中cegui::Window::setAlpha方法的典型用法代码示例。如果您正苦于以下问题:C++ Window::setAlpha方法的具体用法?C++ Window::setAlpha怎么用?C++ Window::setAlpha使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::Window
的用法示例。
在下文中一共展示了Window::setAlpha方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadMainMenu
void GUIManager::LoadMainMenu()
{
CEGUI::ImagesetManager::getSingletonPtr()->createFromImageFile("mainMenuBG","background.tga");
//add background
CEGUI::Window *mainMenu = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage", "mainMenu");
sheet->addChildWindow(mainMenu);
mainMenu->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0)));
mainMenu->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0), CEGUI::UDim(0, 0)));
mainMenu->setProperty("Image", "set:mainMenuBG image:full_image" );
mainMenu->setAlpha(1.0);
CEGUI::PushButton* login = (CEGUI::PushButton*)CEGUI::WindowManager::getSingleton().createWindow("WindowsLook/Button");
mainMenu->addChildWindow(login);
login->setArea(CEGUI::URect(CEGUI::UDim(0.2f,0), CEGUI::UDim(0.65f,0),
CEGUI::UDim(0.3f,0), CEGUI::UDim(0.7f,0)));
login->subscribeEvent(CEGUI::PushButton::EventActivated, CEGUI::Event::Subscriber(&GUIManager::HandleGameLoginClicked, this));
}
示例2: addFrameGraph
void McsHudGui::addFrameGraph(CEGUI::Window* sheet)
{
Ogre::TexturePtr tex = mOgreRoot->getTextureManager()->createManual(
"FrameGraph", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
TimeGraphMaxFrames, TimeGraphMaxResolution, 0, Ogre::PF_R8G8B8, Ogre::TU_RENDERTARGET);
Ogre::SceneManager* debugSceneMgr = mOgreRoot->createSceneManager(Ogre::ST_GENERIC);
debugSceneMgr->setAmbientLight(Ogre::ColourValue(1.0f, 1.0f, 1.0f));
Ogre::MaterialPtr frameLinesMaterial = Ogre::MaterialManager::getSingleton().create("frameLinesMaterial","Game");
frameLinesMaterial->setReceiveShadows(false);
frameLinesMaterial->getTechnique(0)->setLightingEnabled(false);
frameLinesMaterial->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
frameLinesMaterial->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false);
mFrameLines = new FrameGraphRenderable(TimeGraphMaxFrames, TimeGraphMaxResolution);
mFrameLines->setMaterial("frameLinesMaterial");
Ogre::SceneNode* frameLinesNode = debugSceneMgr->getRootSceneNode()->createChildSceneNode("frameGraph_node");
frameLinesNode->attachObject(mFrameLines);
Ogre::Camera* dbg_camera = debugSceneMgr->createCamera("item_camera");
dbg_camera->setAspectRatio(static_cast<Ogre::Real>(TimeGraphMaxFrames) / static_cast<Ogre::Real>(TimeGraphMaxResolution));
Ogre::Viewport *v = tex->getBuffer()->getRenderTarget()->addViewport(dbg_camera);
v->setClearEveryFrame( true );
v->setBackgroundColour( Ogre::ColourValue::Black );
CEGUI::Texture& guiTex = mCeRenderer->createTexture(tex);
CEGUI::Imageset& imageSet = CEGUI::ImagesetManager::getSingleton().create("FrameGraphImageset", guiTex);
imageSet.defineImage("FrameGraphImage", CEGUI::Point(0.0f, 0.0f), CEGUI::Size(guiTex.getSize()), CEGUI::Point(0.0f, 0.0f));
CEGUI::Window* si = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage", "FrameGraphWindow");
si->setSize(CEGUI::UVector2(CEGUI::UDim(0.0f, TimeGraphMaxFrames), CEGUI::UDim(0.0f, TimeGraphMaxResolution)));
si->setPosition(CEGUI::UVector2(CEGUI::UDim(0.0f, 0), CEGUI::UDim(1.0f, -TimeGraphMaxResolution)));
si->setProperty("Image", CEGUI::PropertyHelper::imageToString(&imageSet.getImage("FrameGraphImage")));
si->setAlpha(0.6f);
si->setProperty("BackgroundEnabled", "False");
si->setProperty("FrameEnabled", "False");
sheet->addChildWindow(si);
}
示例3: cargarImagen
void Gui::cargarImagen(const string &imagen, const string &nombre)
{
CEGUI::Window *myImageWindow = CEGUI::WindowManager::getSingleton().createWindow("Menu/StaticImage", nombre);
wMgrPtr->getWindow("Root")->addChildWindow(myImageWindow);
myImageWindow->setPosition(CEGUI::UVector2( CEGUI::UDim( 0, 0 ), CEGUI::UDim( 0, 0 ) ) );
cout<<"h " << h << endl;
float proporcion = (float)h / 1920;
cout<<"proporcion " << proporcion << endl;
int ancho = 944*proporcion;
cout<<"ancho " << ancho << endl;
myImageWindow->setSize(CEGUI::UVector2(CEGUI::UDim(0,ancho),CEGUI::UDim(1,0)));
myImageWindow->setProperty("Image",imagen);
myImageWindow->setProperty("BackgroundEnabled", "true");
myImageWindow->setProperty("FrameEnabled", "False");
myImageWindow->setText("Prueba de texto dentro de la ventana");
myImageWindow->setTooltipText("Texto de la imagen");
myImageWindow->setAlpha(1.0);
}
示例4: createChild
CGUIStatistics::CGUIStatistics(Window *pRoot)
: m_iSelectedSlot(0) {
CInputListenerManager::getSingleton().addInputListener(this);
// create cegui windows/buttons
Window *pStatisticsRoot = pRoot->createChild("DefaultWindow", "GUIStatisticsRoot");
pStatisticsRoot->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0), CEGUI::UDim(0, 0)));
pStatisticsRoot->setSize(CEGUI::USize(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0)));
pStatisticsRoot->setInheritsAlpha(false);
pStatisticsRoot->setAlpha(1);
pStatisticsRoot->setRiseOnClickEnabled(false);
pStatisticsRoot->moveToBack();
m_pStatisticsRoot = pStatisticsRoot;
CEGUI::Window *pBackground = pStatisticsRoot->
createChild("OgreTray/StaticImage", "Background");
pBackground->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0), CEGUI::UDim(0, 0)));
pBackground->setSize(CEGUI::USize(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0)));
pBackground->setInheritsAlpha(false);
pBackground->setAlpha(1);
pBackground->setProperty("Image", "main_menu_background/full");
pBackground->setProperty("FrameEnabled", "False");
pBackground->setProperty("BackgroundEnabled", "True");
pBackground->setRiseOnClickEnabled(false);
CEGUI::Window *pButtonContainer = pStatisticsRoot->createChild("DefaultWindow", "ButtonContainer");
pButtonContainer->setPosition(UVector2(UDim(0, 0), UDim(0, 0)));
pButtonContainer->setSize(USize(UDim(1, 0), UDim(1, 0)));
CEGUI::Window *pFinishedText = pButtonContainer->createChild("OgreTray/Titlebar", "text");
pFinishedText->setFont("dejavusans20");
pFinishedText->setText("unset");
pFinishedText->setPosition(UVector2(UDim(0.05,0), UDim(0.05,0)));
pFinishedText->setSize(USize(UDim(0.9, 0), UDim(0.1, 0)));
CEGUI::Window *pStatisticsGroup = pButtonContainer->createChild("OgreTray/Group", "statisticsgroup");
pStatisticsGroup->setFont("dejavusans16");
pStatisticsGroup->setText(XMLResources::GLOBAL.getCEGUIString("Statistics"));
pStatisticsGroup->setPosition(UVector2(UDim(0.1, 0), UDim(0.2, 0)));
pStatisticsGroup->setSize(USize(UDim(0.8, 0), UDim(0.5, 0)));
CEGUI::Window *pRetryButton = pButtonContainer->createChild("OgreTray/Button", "Retry");
pRetryButton->setPosition(UVector2(UDim(0.1, 0), UDim(0.8, 0)));
pRetryButton->setSize(USize(UDim(0.3, 0), UDim(0.15, 0)));
pRetryButton->setFont("dejavusans16");
pRetryButton->setText(XMLResources::GLOBAL.getCEGUIString("Retry"));
m_pButtons[BT_RETRY] = pRetryButton;
pRetryButton->subscribeEvent(
CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(&CGUIStatistics::onRetryClicked, this));
CEGUI::Window *pToMenuButton = pButtonContainer->createChild("OgreTray/Button", "ToMenu");
pToMenuButton->setPosition(UVector2(UDim(0.6, 0), UDim(0.8, 0)));
pToMenuButton->setSize(USize(UDim(0.3, 0), UDim(0.15, 0)));
pToMenuButton->setFont("dejavusans16");
pToMenuButton->setText(XMLResources::GLOBAL.getCEGUIString("To level selection"));
pToMenuButton->subscribeEvent(
CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(&CGUIStatistics::onToMenuClicked, this));
m_pButtons[BT_TO_MENU] = pToMenuButton;
for (int i = 0; i < L_COUNT; i++) {
createLabel(i, pStatisticsGroup, false);
createLabel(i, pStatisticsGroup, true);
}
hide();
}
示例5: initialise
//.........这里部分代码省略.........
guiContext->setRootWindow(background);
d_alarm = (Timer*)winMgr.createWindow("Timer");
background->addChild(d_alarm);
d_alarm->setDelay(0.5); // Tick each 0.5 seconds
// create the game frame
Window* frame = winMgr.createWindow("Vanilla/FrameWindow");
d_alarm->addChild(frame);
frame->setXPosition(UDim(0.3f, 0.0f));
frame->setYPosition(UDim(0.15f, 0.0f));
frame->setWidth(UDim(0.4f, 0.0f));
frame->setHeight(UDim(0.7f, 0.0f));
frame->setText("CEGUI Minesweeper");
// create the action panel
Window* action = winMgr.createWindow("DefaultWindow");
frame->addChild(action);
action->setXPosition(UDim(0.03f, 0.0f));
action->setYPosition(UDim(0.10f, 0.0f));
action->setWidth(UDim(0.94f, 0.0f));
action->setHeight(UDim(0.1f, 0.0f));
d_counter = (Editbox*)winMgr.createWindow("Vanilla/Editbox", "mine_counter");
action->addChild(d_counter);
d_counter->setText("0");
d_counter->setTooltipText("Number of mine");
d_counter->setReadOnly(true);
d_counter->setXPosition(UDim(0.0f, 0.0f));
d_counter->setYPosition(UDim(0.0f, 0.0f));
d_counter->setWidth(UDim(0.3f, 0.0f));
d_counter->setHeight(UDim(1.0f, 0.0f));
Window* newGame = winMgr.createWindow("Vanilla/Button", "new_game");
action->addChild(newGame);
newGame->setText("Start");
newGame->setTooltipText("Start a new game");
newGame->setXPosition(UDim(0.35f, 0.0f));
newGame->setYPosition(UDim(0.0f, 0.0f));
newGame->setWidth(UDim(0.3f, 0.0f));
newGame->setHeight(UDim(1.0f, 0.0f));
newGame->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&MinesweeperSample::handleGameStartClicked, this));
d_timer = (Editbox*)winMgr.createWindow("Vanilla/Editbox", "timer");
action->addChild(d_timer);
d_timer->setText("0");
d_timer->setTooltipText("Time elapsed");
d_timer->setReadOnly(true);
d_timer->setXPosition(UDim(0.7f, 0.0f));
d_timer->setYPosition(UDim(0.0f, 0.0f));
d_timer->setWidth(UDim(0.3f, 0.0f));
d_timer->setHeight(UDim(1.0f, 0.0f));
d_alarm->subscribeEvent(Timer::EventTimerAlarm, Event::Subscriber(&MinesweeperSample::handleUpdateTimer, this));
// Board button grid
Window* grid = winMgr.createWindow("DefaultWindow");
frame->addChild(grid);
grid->setXPosition(UDim(0.03f, 0.0f));
grid->setYPosition(UDim(0.23f, 0.0f));
grid->setWidth( UDim(0.94f, 0.0f));
grid->setHeight( UDim(0.74f, 0.0f));
const float d_inc = 1.0f / MinesweeperSize;
for(size_t i = 0 ; i < MinesweeperSize ; ++i)
{
// create a container for each row
Window* row = winMgr.createWindow("DefaultWindow");
row->setArea(URect(UDim(0,0), UDim(d_inc * i, 0),
UDim(1,0), UDim(d_inc * (i + 1), 0)));
grid->addChild(row);
for(size_t j = 0 ; j < MinesweeperSize ; ++j)
{
// Initialize buttons coordinate
d_buttonsMapping[i][j].d_col = j;
d_buttonsMapping[i][j].d_row = i;
d_buttons[i][j] = (PushButton*)winMgr.createWindow("Vanilla/Button");
row->addChild(d_buttons[i][j]);
d_buttons[i][j]->setArea(URect(UDim(d_inc * j, 0), UDim(0,0),
UDim(d_inc * (j + 1), 0), UDim(1,0)));
d_buttons[i][j]->setEnabled(false);
// Associate user data
d_buttons[i][j]->setUserData(&(d_buttonsMapping[i][j]));
d_buttons[i][j]->setID(0);
// Connect event handlers
d_buttons[i][j]->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&MinesweeperSample::handleMineButtonClicked, this));
d_buttons[i][j]->subscribeEvent(Window::EventMouseButtonDown, Event::Subscriber(&MinesweeperSample::handleMineButtonDown, this));
}
}
d_result = winMgr.createWindow("Vanilla/StaticText");
grid->addChild(d_result);
d_result->setXPosition(UDim(0.0, 0.0));
d_result->setYPosition(UDim(0.0, 0.0));
d_result->setWidth(UDim(1.0, 0.0));
d_result->setHeight(UDim(1.0, 0.0));
d_result->setAlwaysOnTop(true);
d_result->setProperty("HorzFormatting", "HorzCentred");
d_result->setVisible(false);
d_result->setAlpha(0.67f);
// activate the background window
background->activate();
// success!
return true;
}