本文整理汇总了C++中rocket::core::ElementDocument::RemoveReference方法的典型用法代码示例。如果您正苦于以下问题:C++ ElementDocument::RemoveReference方法的具体用法?C++ ElementDocument::RemoveReference怎么用?C++ ElementDocument::RemoveReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rocket::core::ElementDocument
的用法示例。
在下文中一共展示了ElementDocument::RemoveReference方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LevelFileDataSource
void Phobos::Game::Gui::LevelSelector::Open()
{
m_fCloseRequested = false;
m_upDataSource.reset( PH_NEW LevelFileDataSource(m_lstLevelPaths));
m_upDataGridController.reset(PH_NEW(DataGridController));
m_spGuiContext = Engine::Gui::Manager::GetInstance().CreateContext("LevelSelector");
Rocket::Core::ElementDocument* cursor = m_spGuiContext->LoadMouseCursor("resources/gui/LevelSelector/cursor.rml");
if (cursor)
cursor->RemoveReference();
Rocket::Core::ElementDocument* document = m_spGuiContext->LoadDocument("resources/gui/LevelSelector/main.rml");
if (document)
{
document->SetTitle(Rocket::Core::String("Select Level"));
document->Show();
document->RemoveReference();
Rocket::Controls::ElementDataGrid *dataGrid = dynamic_cast<Rocket::Controls::ElementDataGrid*>(document->GetElementById("datagrid"));
int numRows = dataGrid->GetNumRows();
dataGrid->AddEventListener("rowadd", m_upDataGridController.get());
dataGrid->AddEventListener("keydown", m_upDataGridController.get());
document->GetElementById("loadForm")->AddEventListener("submit", &clLevelSelectorEventListener_gl);
document->GetElementById("quitForm")->AddEventListener("submit", &clLevelSelectorEventListener_gl);
}
}
示例2: file
Rocket::Core::ElementDocument*
UIContext::load_document_file( const std::string& filename )
{
Rocket::Core::ElementDocument* doc = nullptr;
NOM_ASSERT( this->context_ != nullptr );
if( this->context_ != nullptr )
{
doc = this->context_->LoadDocument( filename.c_str() );
if( doc ) {
doc->RemoveReference();
}
else { // doc == nullptr
NOM_LOG_ERR( NOM_LOG_CATEGORY_APPLICATION,
"Could not load document from file:", filename );
}
}
else {
NOM_LOG_ERR( NOM_LOG_CATEGORY_APPLICATION,
"Could not load document from file (invalid context):",
filename );
}
return doc;
}
示例3: LoadWindow
// Loads a window and binds the event handler for it.
bool EventManager::LoadWindow(const Rocket::Core::String& window_name)
{
// Set the event handler for the new screen, if one has been registered.
EventHandler* old_event_handler = event_handler;
EventHandlerMap::iterator iterator = event_handlers.find(window_name);
if (iterator != event_handlers.end())
event_handler = (*iterator).second;
else
event_handler = NULL;
// Attempt to load the referenced RML document.
char path[1024];
GetMmoResourcePath(path, 1024, (window_name + ".rml").CString());
Rocket::Core::ElementDocument* document = gContext->LoadDocument(path);
if (document == NULL)
{
event_handler = old_event_handler;
return false;
}
// Set the element's title on the title; IDd 'title' in the RML.
Rocket::Core::Element* title = document->GetElementById("title");
if (title != NULL)
title->SetInnerRML(document->GetTitle());
document->Focus();
document->Show();
// Remove the caller's reference.
document->RemoveReference();
return true;
}
示例4:
Rocket::Core::ElementDocument* UIContext::load_mouse_cursor_file( const std::string& filename )
{
Rocket::Core::ElementDocument* cursor = nullptr;
if( this->context_ )
{
cursor = this->context_->LoadMouseCursor( filename.c_str() );
if( cursor )
{
cursor->RemoveReference();
cursor->Show();
}
else // cursor == nullptr
{
NOM_LOG_ERR( NOM_LOG_CATEGORY_APPLICATION, "Could not load mouse cursor from file:", filename );
}
}
else
{
NOM_LOG_CRIT( NOM_LOG_CATEGORY_APPLICATION, "Could not load mouse cursor: invalid context with file:", filename );
}
return cursor;
}
示例5: Start
void HelloWorld::Start()
{
helloScene_ = new Scene(context_);
CreateObjects();
CreateText();
SubscribeToEvents();
//Rocket stuff
Rocket::Core::SetRenderInterface(&rocketRenderer);
Rocket::Core::SetSystemInterface(&rocketSystemInterface);
Rocket::Core::Initialise();
int w = GetSubsystem<Graphics>()->GetWidth();
int h = GetSubsystem<Graphics>()->GetHeight();
rocketContext = Rocket::Core::CreateContext("main", Rocket::Core::Vector2i(w, h));
if(rocketContext == NULL)
{
Rocket::Core::Shutdown();
throw "Dead in the water";
}
Rocket::Core::FontDatabase::LoadFontFace("Data/Fonts/Delicious-Bold.otf");
Rocket::Core::FontDatabase::LoadFontFace("Data/Fonts/Delicious-BoldItalic.otf");
Rocket::Core::FontDatabase::LoadFontFace("Data/Fonts/Delicious-Italic.otf");
Rocket::Core::FontDatabase::LoadFontFace("Data/Fonts/Delicious-Roman.otf");
Rocket::Core::ElementDocument *Document = rocketContext->LoadDocument("Data/UI/rocketDemo.html");
if(Document)
{
Document->Show();
Document->RemoveReference();
};
}
示例6:
Rocket::Core::ElementDocument *RocketModule::loadDocument( const char *filename, bool show )
{
Rocket::Core::ElementDocument *document;
// YES I really had to make a function for this!
document = context->LoadDocument( filename );
if( show && document )
{
// load documents with autofocus disabled
document->Show( Rocket::Core::ElementDocument::NONE );
document->Focus();
// reference counting may bog on us if we cache documents!
document->RemoveReference();
// optional element specific eventlisteners here
// only for UI documents! FIXME: we are already doing this in NavigationStack
Rocket::Core::EventListener *listener = UI_GetMainListener();
document->AddEventListener( "keydown", listener );
document->AddEventListener( "change", listener );
}
return document;
}
示例7: loadCursor
// Load the mouse cursor and release the caller's reference:
// NOTE: be sure to use it before initRocket( .. ) function
void RocketModule::loadCursor( int contextId, const String& rmlCursor )
{
Rocket::Core::ElementDocument* cursor = contextForId( contextId )->LoadMouseCursor( rmlCursor );
if( cursor )
cursor->RemoveReference();
}
示例8: unloadGUI
void GuiDemo::unloadGUI()
{
if (m_document)
{
m_document->RemoveReference();
m_document = 0;
}
// Shutdown Lua before we shut down Rocket.
Rocket::Core::Lua::Interpreter::Shutdown();
}
示例9: LoadDocumentFromMemory
// The "LoadDocument" function bound into Python context objects instead of the C++ function.
python::object ContextInterface::LoadDocumentFromMemory(Context* self, const char* stream)
{
Rocket::Core::ElementDocument* document = self->LoadDocumentFromMemory(stream);
if (document == NULL)
return python::object();
// Remove the C++ caller reference and return the python::object
python::object py_document = Rocket::Core::Python::Utilities::MakeObject(document);
document->RemoveReference();
return py_document;
}
示例10: CreateDocument
// The "CreateDocument" function bound into Python context objects instead of the C++ function.
python::object ContextInterface::CreateDocument(Context* self, const char* tag)
{
Rocket::Core::ElementDocument* document = self->CreateDocument(tag);
if (document == NULL)
return python::object();
// Remove the C++ caller reference and add a Python one to replace it.
python::object py_document = Rocket::Core::Python::Utilities::MakeObject(document);
document->RemoveReference();
return py_document;
}
示例11: createScene
void RocketApplication::createScene()
{
Ogre::ResourceGroupManager::getSingleton().createResourceGroup("Rocket");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(rocket_path.Replace("\\", "/").CString(), "FileSystem", "Rocket");
// Rocket initialisation.
ogre_renderer = new RenderInterfaceOgre3D(mWindow->getWidth(), mWindow->getHeight());
Rocket::Core::SetRenderInterface(ogre_renderer);
ogre_system = new SystemInterfaceOgre3D();
Rocket::Core::SetSystemInterface(ogre_system);
Rocket::Core::Initialise();
Rocket::Controls::Initialise();
// Load the fonts from the path to the sample directory.
Rocket::Core::FontDatabase::LoadFontFace(sample_path + "../../assets/Delicious-Roman.otf");
Rocket::Core::FontDatabase::LoadFontFace(sample_path + "../../assets/Delicious-Bold.otf");
Rocket::Core::FontDatabase::LoadFontFace(sample_path + "../../assets/Delicious-Italic.otf");
Rocket::Core::FontDatabase::LoadFontFace(sample_path + "../../assets/Delicious-BoldItalic.otf");
context = Rocket::Core::CreateContext("main", Rocket::Core::Vector2i(mWindow->getWidth(), mWindow->getHeight()));
Rocket::Debugger::Initialise(context);
// Load the mouse cursor and release the caller's reference.
Rocket::Core::ElementDocument* cursor = context->LoadMouseCursor(sample_path + "../../assets/cursor.rml");
if (cursor)
cursor->RemoveReference();
Rocket::Core::ElementDocument* document = context->LoadDocument(sample_path + "../../assets/demo.rml");
if (document)
{
document->Show();
document->RemoveReference();
}
// Add the application as a listener to Ogre's render queue so we can render during the overlay.
mSceneMgr->addRenderQueueListener(this);
}
示例12: streamAdapter
bool
CFormBackendImp::LoadLayout( GUCEF::CORE::CIOAccess& layoutStorage )
{GUCEF_TRACE;
CRocketStreamAdapter streamAdapter( layoutStorage );
// Load and show the document.
Rocket::Core::ElementDocument* document = m_context->GetRocketContext()->LoadDocument( &streamAdapter );
if ( NULL != document )
{
document->Show();
document->RemoveReference();
return true;
}
return false;
}
示例13: Rocket_LoadDocument
void Rocket_LoadDocument(const char* path) {
Rocket::Core::ElementDocument* document = menuContext->LoadDocument(path);
Rocket::Core::ElementDocument* other;
if (document) {
document->RemoveReference();
menuContext->PullDocumentToFront(
document); // Ensure any duplicates will be found first.
// Close any other documents which may have the same ID
other = menuContext->GetDocument(document->GetId());
if (other && other != document) {
other->Close();
}
}
}
示例14: uninitRocket
void GuiDemo::uninitRocket()
{
if (m_document) m_document->RemoveReference();
m_document = 0;
// Shutdown Rocket.
if (m_rkContext) m_rkContext->RemoveReference();
m_rkContext = 0;
Rocket::Core::Shutdown();
delete m_rkOgreSystem; m_rkOgreSystem = 0;
delete m_rkOgreRenderer; m_rkOgreRenderer = 0;
delete m_rkFileInterface; m_rkFileInterface = 0;
delete m_rkEventListener; m_rkEventListener = 0;
delete m_rkRenderListener; m_rkRenderListener = 0;
}
示例15: initRocket
void GuiDemo::initRocket()
{
GK_ASSERT(m_scene && !m_rkContext);
gkWindow* window = m_scene->getDisplayWindow();
// Rocket initialisation.
m_rkOgreRenderer = new RenderInterfaceOgre3D(window->getWidth(), window->getHeight());
Rocket::Core::SetRenderInterface(m_rkOgreRenderer);
m_rkOgreSystem = new SystemInterfaceOgre3D();
Rocket::Core::SetSystemInterface(m_rkOgreSystem);
Rocket::Core::Initialise();
Rocket::Controls::Initialise();
installRocketFonts();
m_rkContext = Rocket::Core::CreateContext("main", Rocket::Core::Vector2i(window->getWidth(), window->getHeight()));
Rocket::Debugger::Initialise(m_rkContext);
m_rkFileInterface = new FileInterfaceOgre3D();
Rocket::Core::SetFileInterface(m_rkFileInterface);
// Load the mouse cursor and release the caller's reference.
Rocket::Core::ElementDocument* cursor = m_rkContext->LoadMouseCursor(ROCKET_CURSOR_PAGE);
if (cursor)
cursor->RemoveReference();
m_document = m_rkContext->LoadDocument(ROCKET_DEMO_PAGE);
if (m_document)
{
Rocket::Core::Element* button = m_document->GetElementById(DEMO_PAGE_BUTTON_ID);
if (button)
button->AddEventListener("click", this);
m_document->Show();
}
m_rkEventListener = new RocketEventListener(window, m_rkContext);
m_rkRenderListener = new RocketRenderListener(window->getRenderWindow(), m_scene->getManager(), m_rkContext);
}