本文整理汇总了C++中NameValuePairList类的典型用法代码示例。如果您正苦于以下问题:C++ NameValuePairList类的具体用法?C++ NameValuePairList怎么用?C++ NameValuePairList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NameValuePairList类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Win32Window
RenderWindow* Win32GLSupport::newWindow(const String &name, unsigned int width,
unsigned int height, bool fullScreen, const NameValuePairList *miscParams)
{
Win32Window* window = OGRE_NEW Win32Window(*this);
NameValuePairList newParams;
if (miscParams != NULL)
{
newParams = *miscParams;
miscParams = &newParams;
NameValuePairList::const_iterator monitorIndexIt = miscParams->find("monitorIndex");
HMONITOR hMonitor = NULL;
int monitorIndex = -1;
// If monitor index found, try to assign the monitor handle based on it.
if (monitorIndexIt != miscParams->end())
{
if (mMonitorInfoList.empty())
EnumDisplayMonitors(NULL, NULL, sCreateMonitorsInfoEnumProc, (LPARAM)&mMonitorInfoList);
monitorIndex = StringConverter::parseInt(monitorIndexIt->second);
if (monitorIndex < (int)mMonitorInfoList.size())
{
hMonitor = mMonitorInfoList[monitorIndex].hMonitor;
}
}
// If we didn't specified the monitor index, or if it didn't find it
if (hMonitor == NULL)
{
POINT windowAnchorPoint;
NameValuePairList::const_iterator opt;
int left = -1;
int top = -1;
if ((opt = newParams.find("left")) != newParams.end())
left = StringConverter::parseInt(opt->second);
if ((opt = newParams.find("top")) != newParams.end())
top = StringConverter::parseInt(opt->second);
// Fill in anchor point.
windowAnchorPoint.x = left;
windowAnchorPoint.y = top;
// Get the nearest monitor to this window.
hMonitor = MonitorFromPoint(windowAnchorPoint, MONITOR_DEFAULTTOPRIMARY);
}
newParams["monitorHandle"] = StringConverter::toString((size_t)hMonitor);
}
window->create(name, width, height, fullScreen, miscParams);
if(!mInitialWindow)
mInitialWindow = window;
return window;
}
示例2: assert
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);
}
示例3: assert
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()));
}
示例4: setParameterList
//-----------------------------------------------------------------------
void StringInterface::setParameterList(const NameValuePairList& paramList)
{
NameValuePairList::const_iterator i, iend;
iend = paramList.end();
for (i = paramList.begin(); i != iend; ++i)
{
setParameter(i->first, i->second);
}
}
示例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: Root
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: 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();
}
示例8: 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();
}
示例9: buildCommandMap
void CommandMapper::buildCommandMap(KeyAndMouseCommandMap& cmdMap,
const NameValuePairList& values)
{
for (NameValuePairList::const_iterator it = values.begin(); it != values.end(); it++)
{
// Split the path at the ',' character
StringVector keys = Ogre::StringUtil::split(it->second, ",");
for (size_t i = 0; i < keys.size(); i++)
{
int keycode = getKeyCode(keys[i]);
cmdMap[keycode] = CeGuiString(it->first);
LOG_MESSAGE(Logger::UI,
Ogre::String("Key ") + keys[i] + " ("
+ StringConverter::toString(keycode)
+ ") is assigned to command " + it->first);
}
}
}
示例10: 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);
}
示例11: Root
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;
}