本文整理汇总了C++中NameValuePairList::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ NameValuePairList::insert方法的具体用法?C++ NameValuePairList::insert怎么用?C++ NameValuePairList::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NameValuePairList
的用法示例。
在下文中一共展示了NameValuePairList::insert方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createWindow
void OgreRenderer::createWindow(const std::string &title, const WindowSettings& settings)
{
assert(mRoot);
mRoot->initialise(false);
// create a hidden 1x1 background window to keep resources when recreating the secondary (real) window
NameValuePairList params_;
params_.insert(std::make_pair("title", title));
params_.insert(std::make_pair("FSAA", "0"));
params_.insert(std::make_pair("vsync", "false"));
params_.insert(std::make_pair("hidden", "true"));
Ogre::RenderWindow* hiddenWindow = mRoot->createRenderWindow("InactiveHidden", 1, 1, false, ¶ms_);
hiddenWindow->setActive(false);
NameValuePairList params;
params.insert(std::make_pair("title", title));
params.insert(std::make_pair("FSAA", settings.fsaa));
params.insert(std::make_pair("vsync", settings.vsync ? "true" : "false"));
mWindow = mRoot->createRenderWindow(title, settings.window_x, settings.window_y, settings.fullscreen, ¶ms);
// create the semi-transparent black background texture used by the GUI.
// has to be created in code with TU_DYNAMIC_WRITE_ONLY param
// so that it can be modified at runtime.
Ogre::TextureManager::getSingleton().createManual(
"transparent.png",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D,
1, 1,
0,
Ogre::PF_A8R8G8B8,
Ogre::TU_WRITE_ONLY);
}
示例2: createWindow
void OgreRenderer::createWindow(const std::string &title, const WindowSettings& settings)
{
assert(mRoot);
mRoot->initialise(false);
NameValuePairList params;
params.insert(std::make_pair("title", title));
params.insert(std::make_pair("FSAA", settings.fsaa));
params.insert(std::make_pair("vsync", settings.vsync ? "true" : "false"));
int pos_x = SDL_WINDOWPOS_CENTERED_DISPLAY(settings.screen),
pos_y = SDL_WINDOWPOS_CENTERED_DISPLAY(settings.screen);
if(settings.fullscreen)
{
pos_x = SDL_WINDOWPOS_UNDEFINED_DISPLAY(settings.screen);
pos_y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(settings.screen);
}
// Create an application window with the following settings:
mSDLWindow = SDL_CreateWindow(
"OpenMW", // window title
pos_x, // initial x position
pos_y, // initial y position
settings.window_x, // width, in pixels
settings.window_y, // height, in pixels
SDL_WINDOW_SHOWN
| (settings.fullscreen ? SDL_WINDOW_FULLSCREEN : 0) | SDL_WINDOW_RESIZABLE
);
SFO::SDLWindowHelper helper(mSDLWindow, settings.window_x, settings.window_y, title, settings.fullscreen, params);
if (settings.icon != "")
helper.setWindowIcon(settings.icon);
mWindow = helper.getWindow();
// create the semi-transparent black background texture used by the GUI.
// has to be created in code with TU_DYNAMIC_WRITE_ONLY param
// so that it can be modified at runtime.
Ogre::TextureManager::getSingleton().createManual(
"transparent.png",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D,
1, 1,
0,
Ogre::PF_A8R8G8B8,
Ogre::TU_WRITE_ONLY);
mScene = mRoot->createSceneManager(ST_GENERIC);
mFader = new Fader(mScene);
mCamera = mScene->createCamera("cam");
// Create one viewport, entire window
mView = mWindow->addViewport(mCamera);
// Alter the camera aspect ratio to match the viewport
mCamera->setAspectRatio(Real(mView->getActualWidth()) / Real(mView->getActualHeight()));
}
示例3: recreateWindow
void OgreRenderer::recreateWindow(const std::string &title, const WindowSettings &settings)
{
Ogre::ColourValue viewportBG = mView->getBackgroundColour();
mRoot->destroyRenderTarget(mWindow);
NameValuePairList params;
params.insert(std::make_pair("title", title));
params.insert(std::make_pair("FSAA", settings.fsaa));
params.insert(std::make_pair("vsync", settings.vsync ? "true" : "false"));
mWindow = mRoot->createRenderWindow(title, settings.window_x, settings.window_y, settings.fullscreen, ¶ms);
// Create one viewport, entire window
mView = mWindow->addViewport(mCamera);
mView->setBackgroundColour(viewportBG);
adjustViewport();
}
示例4: create
void Window::create()
{
if (mWidth == 0 || mHeight == 0)
{
// use highest resolution (last in supported resolutions)
std::pair<size_t, size_t> res = mSupportedFullscreenResolutions.back();
mWidth = res.first; mHeight = res.second;
}
NameValuePairList settings;
settings.insert(std::make_pair("title", mWindowTitle));
settings.insert(std::make_pair("FSAA", StringConverter::toString(mFSAA)));
settings.insert(std::make_pair("vsync", mVSync ? "true" : "false"));
mRenderWindow = Root::getSingleton().createRenderWindow(mWindowTitle, mWidth, mHeight, mFullscreen, &settings);
WindowEventUtilities::addWindowEventListener(mRenderWindow, mListener);
size_t windowID; mRenderWindow->getCustomAttribute("WINDOW", &windowID);
//mInputManager->create(windowID);
}
示例5: init_render_sys
void init_render_sys()
{
m_root = new Ogre::Root();
m_root->setRenderSystem(m_root->getRenderSystemByName("OpenGL Rendering Subsystem"));
m_root->initialise(false);
m_frm = new wxFrame(0,-1,wxT(""));
NameValuePairList a;
a.insert(std::pair<String,String>("externalWindowHandle",StringConverter::toString( (size_t) m_frm->GetHandle() )));
RenderSystem *sys = m_root->getRenderSystem();
RenderWindow *m_ren = sys->_createRenderWindow(String("OgreRenderWindow_00"),1,1,false,&a);
MaterialManager::getSingleton().initialise();
m_frm->Show(false);
}
示例6: run
void BaseApplication::run()
{
// Construct Ogre::Root
// We handle our stuff manually, so don't want to use any of the files
mRoot = new Root(
/* plugins.cfg file*/ "",
/* config file */ "",
/* log file */ ""
);
PathManager::init ();
// Set render system
//!todo do not hardcode render system
#ifdef _DEBUG
mRoot->loadPlugin(PathManager::ogre_plugin_dir + "/RenderSystem_GL");
RenderSystem* rs = mRoot->getRenderSystemByName("OpenGL Rendering Subsystem");
#else
mRoot->loadPlugin(PathManager::ogre_plugin_dir + "/RenderSystem_Direct3D9");
RenderSystem* rs = mRoot->getRenderSystemByName("Direct3D9 Rendering Subsystem");
#endif
mRoot->setRenderSystem(rs);
// Fire up Ogre::Root
mRoot->initialise(false);
// Create a hidden background window to keep resources
NameValuePairList params;
params.insert(std::make_pair("hidden", "true"));
RenderWindow *wnd = mRoot->createRenderWindow("InactiveHidden", 1, 1, false, ¶ms);
wnd->setActive(false);
Ogre::ResourceGroupManager::getSingleton ().addResourceLocation ("./", "FileSystem");
Ogre::ResourceGroupManager::getSingleton ().initialiseAllResourceGroups ();
// Create input system
//mInputManager = new InputManager();
// Create the application window
mWindow = new Window();
mWindow->mListener = static_cast<WindowEventListener*>(this);
//mWindow->mInputManager = mInputManager;
mWindow->mWidth = 800;
mWindow->mHeight = 600;
mWindow->mFullscreen = false;
mWindow->create();
createScene();
mRoot->addFrameListener(this);
}
示例7: createOgreRenderWindow
void wxOgrePanel::createOgreRenderWindow()
{
int width;
int height;
RenderSystem *sys = OgreInitializer::root()->getRenderSystem();
NameValuePairList a;
a.insert(std::pair<String,String>("externalWindowHandle",StringConverter::toString( (size_t) this->GetHandle() )));
GetSize(&width, &height);
m_unique_name = StringConverter::toString((size_t) GetId());
m_RenderWindow = sys->_createRenderWindow(String("OgreRenderWindow")+m_unique_name,width,height,false,&a);
m_Root = OgreInitializer::root();
createSceneManager();
createCamera();
m_ViewPort = m_RenderWindow->addViewport(m_Camera);
m_ViewPort->setBackgroundColour(Ogre::ColourValue(1.0f, ((GetId()*23)&0xFF)/255.0f, 0.0f, 1.0f));
update();
}
示例8: run
void BaseApplication::run()
{
// Construct Ogre::Root
// We handle our stuff manually, so don't want to use any of the files
mRoot = new Root(
/* plugins.cfg file*/ "",
/* config file */ "",
/* log file */ ""
);
// Set render system
mRoot->loadPlugin(OGRE_PLUGIN_DIR_REL + std::string("/RenderSystem_GL"));
RenderSystem* rs = mRoot->getRenderSystemByName("OpenGL Rendering Subsystem");
mRoot->setRenderSystem(rs);
// Fire up Ogre::Root
mRoot->initialise(false);
// Create the application window
NameValuePairList settings;
settings.insert(std::make_pair("title", "OGRE Application"));
settings.insert(std::make_pair("FSAA", "0"));
settings.insert(std::make_pair("vsync", "false"));
mWindow = Root::getSingleton().createRenderWindow("OGRE Application", 800, 600, false, &settings);
WindowEventUtilities::addWindowEventListener(mWindow, this);
size_t windowID;
mWindow->getCustomAttribute("WINDOW", &windowID);
// Create input system
OIS::ParamList pl;
std::ostringstream windowHndStr;
windowHndStr << windowID;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
#ifdef OIS_LINUX_PLATFORM
pl.insert(std::make_pair(std::string("x11_mouse_grab"), std::string("false")));
pl.insert(std::make_pair(std::string("x11_mouse_hide"), std::string("false")));
pl.insert(std::make_pair(std::string("x11_keyboard_grab"), std::string("false")));
pl.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true")));
#endif
mOIS = OIS::InputManager::createInputSystem( pl );
// Create devices
if (mOIS->getNumberOfDevices(OIS::OISKeyboard) > 0)
{
mOISKeyboard = static_cast<OIS::Keyboard*>(mOIS->createInputObject(OIS::OISKeyboard, true));
mOISKeyboard->setEventCallback(this);
}
if (mOIS->getNumberOfDevices(OIS::OISMouse) > 0)
{
mOISMouse = static_cast<OIS::Mouse*>(mOIS->createInputObject(OIS::OISMouse, true));
mOISMouse->setEventCallback(this);
}
// Start the rendering loop
createScene();
mRoot->addFrameListener(this);
mRoot->startRendering();
// Shutdown
if (mOISMouse)
mOIS->destroyInputObject(mOISMouse);
if (mOISKeyboard)
mOIS->destroyInputObject(mOISKeyboard);
mOIS->destroyInputSystem(mOIS);
mRoot->removeFrameListener(this);
delete mRoot;
}