本文整理汇总了C++中rocket::core::ElementDocument::Show方法的典型用法代码示例。如果您正苦于以下问题:C++ ElementDocument::Show方法的具体用法?C++ ElementDocument::Show怎么用?C++ ElementDocument::Show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rocket::core::ElementDocument
的用法示例。
在下文中一共展示了ElementDocument::Show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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;
}
示例2:
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;
}
示例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: 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();
};
}
示例5: 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);
}
}
示例6: 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;
}
示例7: 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);
}
示例8: glewInit
/*
* Create Application
*/
Application::Application()
: window_(sf::VideoMode(1024, 768), "SpaceG", sf::Style::Titlebar | sf::Style::Close ),
currentState_(nullptr)
{
//Handle the view seperate from rendertexture and window
//setting up sfml render stuff
window_.setFramerateLimit(60);
auto size = window_.getSize();
renderTexture_.create(size.x, size.y);
view_ = renderTexture_.getView();
renderTexture_.setView(view_);
//glew init
glewInit();
//logging:
auto cs = window_.getSettings();
cul::Log::Source().verbose("OpenGL Context: %d.%d", cs.majorVersion, cs.minorVersion);
//depthBits, stencilBits, antialiasingLevel
//GUI Init
//Getting directly rendered to window not to render texture
uiRenderInterface_ = new SfmlRenderInterface(&window_);
Rocket::Core::SetRenderInterface(uiRenderInterface_);
Rocket::Core::SetSystemInterface(&uiSysInterface_);
Rocket::Core::Initialise();
uiCtx_ = Rocket::Core::CreateContext("default", Rocket::Core::Vector2i(size.x, size.y));
//Load Fonts
Rocket::Core::FontDatabase::LoadFontFace("data/font/LinLibertine_Rah.ttf", "Libertine", Rocket::Core::Font::STYLE_NORMAL, Rocket::Core::Font::WEIGHT_NORMAL);
//test
Rocket::Core::ElementDocument* document = uiCtx_->LoadDocument("data/ui_test.rml");
if (document != NULL)
document->Show();
Rocket::Debugger::Initialise(uiCtx_);
}
示例9: 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);
}
示例10:
// Loads a window and binds the event handler for it.
Rocket::Core::ElementDocument* 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;
//Rocket::Core::Log::Message(Rocket::Core::Log::LT_INFO, "%s", window_name.CString());
}
else
event_handler = NULL;
// Attempt to load the referenced RML document.
Rocket::Core::String document_path = Rocket::Core::String("data/") + window_name + Rocket::Core::String(".rml");
Rocket::Core::ElementDocument* document = Context->LoadDocument(document_path.CString());
if (document == nullptr)
{
event_handler = old_event_handler;
return nullptr;
}
document->SetId(window_name);
// 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 document;
}
示例11: loadGUI
void GuiDemo::loadGUI()
{
GK_ASSERT(m_scene);
// Install fonts
gkGUIManager *gm = gkGUIManager::getSingletonPtr();
gm->loadFont("Delicious-Roman");
gm->loadFont("Delicious-Bold");
gm->loadFont("Delicious-Italic");
gm->loadFont("Delicious-BoldItalic");
// Initialise the Lua interface
Rocket::Core::Lua::Interpreter::Initialise();
Rocket::Controls::Lua::RegisterTypes(Rocket::Core::Lua::Interpreter::GetLuaState());
//Rocket::Core::Vector2f v; v.Normalise();
// Create context
gkGUI *gui = m_scene->getDisplayWindow()->getGUI();
// Enable debugger (shift+~)
gm->setDebug(gui);
// Load the mouse cursor and release the caller's reference.
Rocket::Core::ElementDocument* cursor = gui->getContext()->LoadMouseCursor(ROCKET_CURSOR_PAGE);
if (cursor)
cursor->RemoveReference();
m_document = gui->getContext()->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();
}
}
示例12: UiBase
GameMenu::GameMenu(WindowFramework* window, Rocket::Core::Context* context) : UiBase(window, context)
{
Rocket::Core::ElementDocument* doc = context->LoadDocument("data/main_menu.rml");
root = doc;
if (doc)
{
doc->Show();
ToggleEventListener(true, "continue", "click", _continueClicked);
ToggleEventListener(true, "options", "click", _optionsClicked);
ToggleEventListener(true, "exit", "click", _exitClicked);
ToggleEventListener(true, "save", "click", _saveClicked);
ToggleEventListener(true, "load", "click", _loadClicked);
_continueClicked.EventReceived.Connect(*this, &GameMenu::MenuEventContinue);
_exitClicked.EventReceived.Connect(ExitClicked, &Sync::Signal<void (Rocket::Core::Event&)>::Emit);
_saveClicked.EventReceived.Connect(SaveClicked, &Sync::Signal<void (Rocket::Core::Event&)>::Emit);
_loadClicked.EventReceived.Connect(LoadClicked, &Sync::Signal<void (Rocket::Core::Event&)>::Emit);
_optionsClicked.EventReceived.Connect(OptionsClicked, &Sync::Signal<void (Rocket::Core::Event&)>::Emit);
Translate();
}
}
示例13: Undefined
Handle<Value> EDShow(const Arguments& args)
{
Rocket::Core::ElementDocument* v = UnwrapElementDocument(args.This());
v->Show();
return Undefined();
}
示例14: main
int main(int ROCKET_UNUSED(argc), char** ROCKET_UNUSED(argv))
#endif
{
// Generic OS initialisation, creates a window and does not attach OpenGL.
if (!Shell::Initialise("../Samples/basic/directx/") ||
!Shell::OpenWindow("DirectX Sample", false))
{
Shell::Shutdown();
return -1;
}
// DirectX initialisation.
if (!InitialiseDirectX())
{
Shell::CloseWindow();
Shell::Shutdown();
return -1;
}
// Install our DirectX render interface into Rocket.
RenderInterfaceDirectX directx_renderer(g_pD3D, g_pd3dDevice);
Rocket::Core::SetRenderInterface(&directx_renderer);
ShellSystemInterface system_interface;
Rocket::Core::SetSystemInterface(&system_interface);
Rocket::Core::Initialise();
// Create the main Rocket context and set it on the shell's input layer.
context = Rocket::Core::CreateContext("main", Rocket::Core::Vector2i(1024, 768));
if (context == NULL)
{
Rocket::Core::Shutdown();
Shell::Shutdown();
return -1;
}
Rocket::Debugger::Initialise(context);
Input::SetContext(context);
Shell::LoadFonts("../../assets/");
// Load and show the tutorial document.
Rocket::Core::ElementDocument* document = context->LoadDocument("../../assets/demo.rml");
if (document != NULL)
{
document->Show();
document->RemoveReference();
}
Shell::EventLoop(GameLoop);
// Shutdown Rocket.
context->RemoveReference();
Rocket::Core::Shutdown();
ShutdownDirectX();
Shell::CloseWindow();
Shell::Shutdown();
return 0;
}
示例15: main
int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv))
#endif
{
#ifdef ROCKET_PLATFORM_WIN32
ROCKET_UNUSED(instance_handle);
ROCKET_UNUSED(previous_instance_handle);
ROCKET_UNUSED(command_line);
ROCKET_UNUSED(command_show);
#else
ROCKET_UNUSED(argc);
ROCKET_UNUSED(argv);
#endif
// Generic OS initialisation, creates a window and attaches OpenGL.
if (!Shell::Initialise("../Samples/tutorial/template/") ||
!Shell::OpenWindow("Template Tutorial", true))
{
Shell::Shutdown();
return -1;
}
// Rocket initialisation.
ShellRenderInterfaceOpenGL opengl_renderer;
Rocket::Core::SetRenderInterface(&opengl_renderer);
opengl_renderer.SetViewport(1024, 768);
ShellSystemInterface system_interface;
Rocket::Core::SetSystemInterface(&system_interface);
Rocket::Core::Initialise();
// Create the main Rocket context and set it on the shell's input layer.
context = Rocket::Core::CreateContext("main", Rocket::Core::Vector2i(1024, 768));
if (context == NULL)
{
Rocket::Core::Shutdown();
Shell::Shutdown();
return -1;
}
Rocket::Debugger::Initialise(context);
Input::SetContext(context);
Shell::LoadFonts("../../assets/");
// Load and show the tutorial document.
Rocket::Core::ElementDocument* document = context->LoadDocument("data/tutorial.rml");
if (document != NULL)
{
document->Show();
document->RemoveReference();
}
Shell::EventLoop(GameLoop);
// Shutdown Rocket.
context->RemoveReference();
Rocket::Core::Shutdown();
Shell::CloseWindow();
Shell::Shutdown();
return 0;
}