本文整理汇总了C++中cegui::WindowManager类的典型用法代码示例。如果您正苦于以下问题:C++ WindowManager类的具体用法?C++ WindowManager怎么用?C++ WindowManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WindowManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SelectCharacter
bool SelectorHelper::SelectCharacter( const CEGUI::EventArgs& e ) {
CEGUI::Window* window = static_cast<const CEGUI::MouseEventArgs*>(&e)->window;
CEGUI::WindowManager *wmgr = CEGUI::WindowManager::getSingletonPtr();
CEGUI::Window* penguinButton = wmgr->getWindow("Menu/Penguin");
CEGUI::Window* ogreButton = wmgr->getWindow("Menu/Ogre");
CEGUI::Window* ninjaButton = wmgr->getWindow("Menu/Ninja");
if (window == penguinButton) player_flag = CHARACTER_PENGUIN;
else if (window == ogreButton) player_flag = CHARACTER_OGRE;
else if (window == ninjaButton) player_flag = CHARACTER_NINJA;
if (type_flag == TYPE_SINGLE_PLAYER) {
MenuActivity *activity = (MenuActivity*) OgreBallApplication::getSingleton()->activity;
activity->SinglePlayerLevelSelectWrapper(e);
} else if (type_flag == TYPE_MULTI_HOST) {
HostPlayerActivity *activity = (HostPlayerActivity*) OgreBallApplication::getSingleton()->activity;
activity->handlePlayerSelected(player_flag);
} else if (type_flag == TYPE_MULTI_CLIENT) {
ClientPlayerActivity *activity = (ClientPlayerActivity*) OgreBallApplication::getSingleton()->activity;
activity->handlePlayerSelected(player_flag);
}
}
示例2: setupCEGUI
void Application::setupCEGUI()
{
// CEGUI setup
m_renderer = new CEGUI::OgreCEGUIRenderer(m_window, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, m_sceneManager);
m_system = new CEGUI::System(m_renderer);
CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme");
m_system->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
m_system->setDefaultFont((CEGUI::utf8*)"BlueHighway-12");
CEGUI::WindowManager *win = CEGUI::WindowManager::getSingletonPtr();
CEGUI::Window *sheet = win->createWindow("DefaultGUISheet", "Sheet");
float distanceBorder = 0.01;
float sizeX = 0.2;
float sizeY = 0.05;
float posX = distanceBorder;
float posY = distanceBorder;
debugWindow = win->createWindow("TaharezLook/StaticText", "Widget1");
debugWindow->setPosition(CEGUI::UVector2(CEGUI::UDim(posX, 0), CEGUI::UDim(posY, 0)));
debugWindow->setSize(CEGUI::UVector2(CEGUI::UDim(sizeX, 0), CEGUI::UDim(sizeY, 0)));
debugWindow->setText("Debug Info!");
sheet->addChildWindow(debugWindow);
m_system->setGUISheet(sheet);
}
示例3: memBuffer
bool
CFormBackendImp::LoadLayout( GUCEF::CORE::CIOAccess& layoutStorage )
{GUCEF_TRACE;
CEGUI::Window* rootWindow = NULL;
CEGUI::WindowManager* wmgr = CEGUI::WindowManager::getSingletonPtr();
GUCEF_DEBUG_LOG( 0, "Starting layout load for a GUI Form" );
try
{
CORE::CDynamicBuffer memBuffer( layoutStorage );
CEGUI::RawDataContainer container;
container.setData( (CEGUI::uint8*) memBuffer.GetBufferPtr() );
container.setSize( (size_t) memBuffer.GetDataSize() );
rootWindow = wmgr->loadLayoutFromContainer( container );
container.setData( (CEGUI::uint8*) NULL );
container.setSize( (size_t) 0 );
}
catch ( CEGUI::Exception& e )
{
GUCEF_ERROR_LOG( 0, CString( "CEGUI Exception while attempting to load form layout: " ) + e.what() );
return false;
}
// Now that we completed loading lets see what we got from CEGUI
if ( NULL != rootWindow )
{
// Begin by providing a wrapper for the root window
m_rootWindow = CreateAndHookWrapperForWindow( rootWindow );
if ( NULL != m_rootWindow )
{
CString localWidgetName = m_rootWindow->GetName().SubstrToChar( '/', false );
m_widgetMap[ localWidgetName ] = m_rootWindow;
WrapAndHookChildWindows( rootWindow );
// We will directly add the form as a child of the root for now
// Note: This assumes that you have a GUISheet already set, otherwise this will result in a segfault!
CEGUI::Window* globalRootWindow = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow();
if ( NULL != globalRootWindow )
{
globalRootWindow->addChild( rootWindow );
GUCEF_DEBUG_LOG( 0, "Successfully loaded a GUI Form layout" );
return true;
}
else
{
GUCEF_ERROR_LOG( 0, "Failed to add form as a child to the global \"root\" window" );
}
}
rootWindow->hide();
}
GUCEF_DEBUG_LOG( 0, "Failed to load a GUI Form layout" );
return false;
}
示例4: t
//-------------------------------------------------------------------------------------
bool
NetworkManager::connect(const CEGUI::EventArgs&)
{
CEGUI::WindowManager *winMgr = CEGUI::WindowManager::getSingletonPtr();
CEGUI::String Iptmp;
CEGUI::String PortTmp;
unsigned int i = 1;
if (winMgr->isWindowPresent("Connect/ContainerGrp/Ip"))
{
Iptmp = winMgr->getWindow("Connect/ContainerGrp/Ip")->getText();
PortTmp = winMgr->getWindow("Connect/ContainerGrp/Port")->getText();
this->ip_ = std::string(Iptmp.c_str());
this->port_ = StringToNumber<const char *, int>(PortTmp.c_str());
zappy::Convert *c = new zappy::Convert();
zappy::Network::initInstance(this->ip_ , this->port_, *c);
zappy::Network &p = zappy::Network::getInstance();
p.setParameters(this->port_, this->ip_);
p.connect_();
if (p.isConnected())
{
Thread<zappy::Network> t(p);
t.start();
while (p.gettingMap() && i < 5000)
usleep(++i);
this->GfxMgr_->hide("Connect");
this->GfxMgr_->createRealScene();
}
}
return true;
}
示例5: catch
bool
CFormBackendImp::LoadLayout( GUCEF::CORE::CIOAccess& layoutStorage )
{GUCE_TRACE;
CEGUI::Window* rootWindow = NULL;
CEGUI::WindowManager* wmgr = CEGUI::WindowManager::getSingletonPtr();
GUCEF_DEBUG_LOG( 0, "Starting layout load for a GUI Form" );
try
{
// provide hacky access to the given data
m_dummyArchive->AddResource( layoutStorage, "currentFile" );
// Now we can load the window layout from the given storage
// Note that if CEGUI ever provides an interface to do this directly
// clean up this mess !!!
rootWindow = wmgr->loadWindowLayout( "currentFile" ,
m_widgetNamePrefix.C_String() ,
m_resourceGroupName.C_String() );
m_dummyArchive->ClearResourceList();
}
catch ( Ogre::Exception& e )
{
GUCEF_ERROR_LOG( 0, CString( "Ogre Exception while attempting to load form layout: " ) + e.getFullDescription().c_str() );
return false;
}
// Now that we completed loading lets see what we got from CEGUI
if ( NULL != rootWindow )
{
// Begin by providing a wrapper for the root window
m_rootWindow = CreateAndHookWrapperForWindow( rootWindow );
if ( NULL != m_rootWindow )
{
CString localWidgetName = m_rootWindow->GetName().SubstrToChar( '/', false );
m_widgetMap[ localWidgetName ] = m_rootWindow;
WrapAndHookChildWindows( rootWindow );
// We will directly add the form as a child of the root for now
CEGUI::Window* globalRootWindow = wmgr->getWindow( "root" );
if ( NULL != globalRootWindow )
{
globalRootWindow->addChildWindow( rootWindow );
GUCEF_DEBUG_LOG( 0, "Successfully loaded a GUI Form layout" );
return true;
}
else
{
GUCEF_ERROR_LOG( 0, "Failed to add form as a child to the global \"root\" window" );
}
}
rootWindow->hide();
}
GUCEF_DEBUG_LOG( 0, "Failed to loaded a GUI Form layout" );
return false;
}
示例6: createGUIWindow
/**
* Create all widgets and their initial contents.
*
* CEGUI is based on tree structure of Windows. On top of that
* tree is a GUISheet, named "root". Each child has a position and
* a size - both given as values relative to the parent elements area.
* Position is given as the top left corner of a child within the parent area.
* Size is given as the relative portions of the parent area.
*/
void createGUIWindow()
{
CEGUI::System *ceguiSystem= CEGUI::System::getSingletonPtr();
assert(ceguiSystem);
CEGUI::WindowManager *winMgr = CEGUI::WindowManager::getSingletonPtr();
assert(winMgr);
CEGUI::Window *ceguiRoot = winMgr->createWindow("DefaultGUISheet","root");
assert(ceguiRoot);
ceguiSystem->setGUISheet(ceguiRoot); // Top element, fills the display area
CEGUI::UVector2 buttonSize = CEGUI::UVector2(CEGUI::UDim(0.6, 0), CEGUI::UDim(0.1, 0));
setupCEGUIResources();
// Create a button of type "TaharezLook/Button" and name "root/Button"
mButton = winMgr->createWindow(
reinterpret_cast<const CEGUI::utf8*>("TaharezLook/Button"),
reinterpret_cast<const CEGUI::utf8*>("root/Button"));
mButton->setAlpha(0.5f);
mButton->setText("Hello World!");
mButton->setSize(buttonSize);
mButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(0.6, 0)));
mEditBox = winMgr->createWindow(
reinterpret_cast<const CEGUI::utf8*>("TaharezLook/Editbox"),
reinterpret_cast<const CEGUI::utf8*>("root/EditBox"));
mEditBox->setAlpha(0.5f);
mEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.6, 0), CEGUI::UDim(0.1, 0)));
mEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(0.3, 0)));
// Add both created elements to the GUI sheet.
ceguiRoot->addChildWindow(mEditBox);
ceguiRoot->addChildWindow(mButton);
/* Add event subscribers to both elements.
* CEGUI input handling is based on function pointers being subscribed
* to certain events - events of each window type are defined in the
* CEGUI API docs. When the event occurs, all subscriber functions
* are called (in some order?)
*/
// EventTextAccepted occurs when input box has focus, and user presses
// Enter, Return or Tab, and so accepts the input.
mEditBox->subscribeEvent(CEGUI::Editbox::EventTextAccepted,
CEGUI::Event::Subscriber(&inputEntered));
// EventClicked occurs when button is clicked.
mButton->subscribeEvent(CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(&inputEntered));
}
示例7:
LoginScreenInterface::LoginScreenInterface(){
#ifdef WITH_CEGUI_SUPPORT
CEGUI::WindowManager *wmanager = CEGUI::WindowManager::getSingletonPtr();
m_LoginScreenWindow = wmanager->loadWindowLayout(
"loginscreen.layout",
""
);
if (m_LoginScreenWindow)
{
CEGUI::System::getSingleton().getGUISheet()->addChildWindow(m_LoginScreenWindow);
}
#endif
}
示例8: update
void MyGUI::update(float timeSinceLastFrame)
{
//在這裡更新衛星的狀態
CEGUI::WindowManager* winMgr = CEGUI::WindowManager::getSingletonPtr();
//衛星的狀態
CEGUI::String str_status;
if(SatelliteStatus::current_status == SatelliteStatus::UNLAUNCHED){
str_status = GetUTF(L"未发射");
}
else if(SatelliteStatus::current_status == SatelliteStatus::RISING){
str_status = GetUTF(L"上升中");
}
else if(SatelliteStatus::current_status == SatelliteStatus::NEAR_TRACK){
str_status = GetUTF(L"近地轨道");
}
else if(SatelliteStatus::current_status == SatelliteStatus::ECLLIPSE){
str_status = GetUTF(L"椭圆轨道");
}
else if(SatelliteStatus::current_status == SatelliteStatus::FAR_TRACK){
str_status = GetUTF(L"远地轨道");
}
else if(SatelliteStatus::current_status == SatelliteStatus::OUT_CONTROL){
str_status = GetUTF(L"失控");
}
winMgr->getWindow("text_status")->setText(str_status);
//卫星的坐标
char buffer0[1024];
char buffer1[1024];
char buffer2[1024];
sprintf(buffer0,"%f",SatelliteStatus::satellite_x);
sprintf(buffer1,"%f",SatelliteStatus::satellite_y);
sprintf(buffer2,"%f",SatelliteStatus::satellite_z);
CEGUI::String strx(buffer0);
CEGUI::String stry(buffer1);
CEGUI::String strz(buffer2);
winMgr->getWindow("text_x")->setText(strx);
winMgr->getWindow("text_y")->setText(stry);
winMgr->getWindow("text_z")->setText(strz);
//卫星自转角
sprintf(buffer0,"%f",SatelliteStatus::satellite_angle);
CEGUI::String str_rotate(buffer0);
winMgr->getWindow("text_axisaxis")->setText(strx);
//线速度
sprintf(buffer0,"%f km/h",SatelliteStatus::satellite_lv);
CEGUI::String str_lv(buffer0);
winMgr->getWindow("text_lvlv")->setText(str_lv);
//角速度
sprintf(buffer0,"%f /h",SatelliteStatus::satellite_wv);
CEGUI::String str_wv(buffer0);
winMgr->getWindow("text_wvwv")->setText(str_wv);
//线加速度
sprintf(buffer0,"%f /h^2",SatelliteStatus::satellite_a);
CEGUI::String str_a(buffer0);
winMgr->getWindow("text_aa")->setText(str_a);
MyGUISystem::getSingletonPtr()->update(timeSinceLastFrame);
}
示例9:
//-------------------------------------------------------------------------------------
bool
NetworkManager::updateTime(const CEGUI::EventArgs&)
{
CEGUI::WindowManager *winMgr = CEGUI::WindowManager::getSingletonPtr();
std::string time;
std::string s;
if (winMgr->isWindowPresent("Time/Container/Time"))
{
zappy::Network &net = zappy::Network::getInstance();
time = winMgr->getWindow("Time/Container/Time")->getText().c_str();
s = "sst " + time + "\n";
net.setToSend(s);
}
return true;
}
示例10: SwitchToPlayerSelectMenu
void SelectorHelper::SwitchToPlayerSelectMenu(void) {
CEGUI::WindowManager *wmgr = CEGUI::WindowManager::getSingletonPtr();
CEGUI::System::getSingleton().setGUISheet(wmgr->getWindow("Menu/PlayerSelect"));
CEGUI::Window* penguinButton = wmgr->getWindow("Menu/Penguin");
CEGUI::Window* ogreButton = wmgr->getWindow("Menu/Ogre");
CEGUI::Window* ninjaButton = wmgr->getWindow("Menu/Ninja");
penguinButton->subscribeEvent(CEGUI::PushButton::EventClicked,
&SelectorHelper::SelectCharacter);
ogreButton->subscribeEvent(CEGUI::PushButton::EventClicked,
&SelectorHelper::SelectCharacter);
ninjaButton->subscribeEvent(CEGUI::PushButton::EventClicked,
&SelectorHelper::SelectCharacter);
}
示例11: CreateCEGUIWindow
void GameConsoleWindow::CreateCEGUIWindow()
{
// Get a local pointer to the CEGUI Window Manager, Purely for convenience to reduce typing
CEGUI::WindowManager *pWindowManager = CEGUI::WindowManager::getSingletonPtr();
// Now before we load anything, lets increase our instance number to ensure no conflicts.
// I like the format #_ConsoleRoot so thats how i'm gonna make the prefix. This simply
// Increments the iInstanceNumber then puts it + a _ into the sNamePrefix string.
sNamePrefix = ++iInstanceNumber + "_";
// Now that we can ensure that we have a safe prefix, and won't have any naming conflicts lets create the window
// and assign it to our member window pointer m_ConsoleWindow
// inLayoutName is the name of your layout file (for example "console.layout"), don't forget to rename inLayoutName by our layout file
CasaEngine::IFile* pFile = CasaEngine::MediaManager::Instance().FindMedia("GameConsole.layout", CasaEngine::FileMode::READ);
if (pFile != nullptr)
{
CEGUI::String xmlStr(pFile->GetBuffer());
m_ConsoleWindow = pWindowManager->loadLayoutFromString(xmlStr);
DELETE_AO pFile;
pFile = nullptr;
}
else
{
throw CasaEngine::CLoadingFailed("GameConsole.layout", "");
}
// Being a good programmer, its a good idea to ensure that we got a valid window back.
if (m_ConsoleWindow)
{
CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(m_ConsoleWindow);
// Lets add our new window to the Root GUI Window
//CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChildWindow(m_ConsoleWindow);
//CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(m_ConsoleWindow);
// Now register the handlers for the events (Clicking, typing, etc)
(this)->RegisterHandlers();
}
else
{
// Something bad happened and we didn't successfully create the window lets output the information
CEGUI::Logger::getSingleton().logEvent("Error: Unable to load the ConsoleWindow from .layout");
}
}
示例12: createMenu
void InGameMenuWindow::createMenu(MenuBase* menu)
{
CEGUI::WindowManager* windowMan = CEGUI::WindowManager::getSingletonPtr();
const ActionVector actions = ActionManager::getSingleton().getInGameGlobalActions();
map<CeGuiString, PopupMenu*> menuGroups;
for (ActionVector::const_iterator actIter = actions.begin(); actIter != actions.end(); actIter++)
{
Action* action = *actIter;
ActionGroup* group = action->getGroup();
if (group != NULL)
{
PopupMenu* menuGrp;
map<CeGuiString, PopupMenu*>::iterator grpIter = menuGroups.find(group->getName());
if (grpIter != menuGroups.end())
{
menuGrp = (*grpIter).second;
}
else
{
MenuItem* grpItem = static_cast<MenuItem*>(windowMan->createWindow("RastullahLook/MenuItem",
getNamePrefix()+"IngameMenu/"+group->getName()));
grpItem->setText(group->getName());
menu->addChildWindow(grpItem);
menuGrp = static_cast<PopupMenu*>(windowMan->createWindow("RastullahLook/PopupMenu",
getNamePrefix()+"IngameMenu/Menu"+group->getName()));
grpItem->addChildWindow(menuGrp);
menuGroups[group->getName()] = menuGrp;
}
MenuItem* item = static_cast<MenuItem*>(windowMan->createWindow("RastullahLook/MenuItem",
getNamePrefix()+"IngameMenu/"+group->getName()+"/"+action->getName()));
item->setText(action->getDescription());
menuGrp->addChildWindow(item);
setAction(item, action);
}
}
}
示例13: EventSpeedUp
//近地点加速
bool EventSpeedUp(const CEGUI::EventArgs& e)
{
/*if(SatelliteStatus::current_status != SatelliteStatus::NEAR_TRACK){
//TODO: Anouce BUG
return true;
}
SatelliteStatus::current_status = SatelliteStatus::ECLLIPSE;*/
if(SatelliteStatus::current_status != SatelliteStatus::UNLAUNCHED){
return false;
}
//Read the Data and set it
double near_ = 468.55;
double far_ = 800.00;
CEGUI::WindowManager* winMgr = CEGUI::WindowManager::getSingletonPtr();
CEGUI::String& strnear = const_cast<CEGUI::String&>(winMgr->getWindow("edit_near")->getText() );
CEGUI::String& strfar = const_cast<CEGUI::String&>(winMgr->getWindow("edit_far")->getText() );
near_ = atof(strnear.c_str() );
far_ = atof(strfar.c_str() );
SetParameter(near_,far_);
return true;
}
示例14: CreateText
CEGUI::Window* TestAARHUD::CreateText(const std::string& name, CEGUI::Window* parent, const std::string& text,
float x, float y, float width, float height)
{
CEGUI::WindowManager* wm = CEGUI::WindowManager::getSingletonPtr();
// create base window and set our default attribs
CEGUI::Window* result = wm->createWindow("WindowsLook/StaticText", name);
parent->addChildWindow(result);
result->setText(text);
result->setPosition(CEGUI::UVector2(cegui_absdim(x), cegui_absdim(y)));
result->setSize(CEGUI::UVector2(cegui_absdim(width), cegui_absdim(height)));
result->setProperty("FrameEnabled", "false");
result->setProperty("BackgroundEnabled", "false");
result->setHorizontalAlignment(CEGUI::HA_LEFT);
result->setVerticalAlignment(CEGUI::VA_TOP);
// set default color to white
result->setProperty("TextColours",
CEGUI::PropertyHelper::colourToString(CEGUI::colour(1.0f, 1.0f, 1.0f)));
result->show();
return result;
}
示例15: createGUI
void BasicWindow::createGUI(void) {
mRenderer = &CEGUI::OgreRenderer::bootstrapSystem();
CEGUI::Imageset::setDefaultResourceGroup("Imagesets");
CEGUI::Font::setDefaultResourceGroup("Fonts");
CEGUI::Scheme::setDefaultResourceGroup("Schemes");
CEGUI::WidgetLookManager::setDefaultResourceGroup("LookNFeel");
CEGUI::WindowManager::setDefaultResourceGroup("Layouts");
CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme");
CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");
CEGUI::WindowManager* winMgr = CEGUI::WindowManager::getSingletonPtr();
CEGUI::System* guiSystem = CEGUI::System::getSingletonPtr();
CEGUI::Window* rootWindow = winMgr->createWindow("DefaultWindow", "root");
guiSystem->setGUISheet(rootWindow);
/* not using the gui quite yet:
try {
rootWindow->addChildWindow(CEGUI::WindowManager::getSingleton().loadWindowLayout("Console.layout"));
rootWindow->addChildWindow(CEGUI::WindowManager::getSingleton().loadWindowLayout("RightPanel.layout"));
} catch (CEGUI::Exception& e) {
OGRE_EXCEPT(Ogre::Exception::ERR_INTERNAL_ERROR, std::string(e.getMessage().c_str()), "Error parsing gui layout");
}
*/
/*
// "Quit" button:
CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();
CEGUI::Window* sheet = winMgr.createWindow("DefaultWindow", "CEGUIDemo/Sheet");
CEGUI::Window* quit = winMgr.createWindow("TaharezLook/Button", "CEGUIDemo/QuitButton");
quit->setText("Quit");
quit->setSize(CEGUI::UVector2(CEGUI::UDim(0.15f, 0), CEGUI::UDim(0.05f, 0)));
quit->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&BasicWindow::quit, this));
sheet->addChildWindow(quit);
CEGUI::System::getSingleton().setGUISheet(sheet);
*/
}