本文整理汇总了C++中ois::ParamList::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ ParamList::insert方法的具体用法?C++ ParamList::insert怎么用?C++ ParamList::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ois::ParamList
的用法示例。
在下文中一共展示了ParamList::insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createWindow
bool Kernel::createWindow ( uint width, uint height ) {
Ogre::NameValuePairList lParams;
lParams["FSAA"] = "false";
lParams["vsync"] = "false";
OGREWIndow = OGRERoot->createRenderWindow ( "CyberEg{o.o}rg 3D", width, height, false, &lParams );
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
OGRESceneMgr = OGRERoot->createSceneManager ( "OctreeSceneManager" );
OIS::ParamList pl;
size_t windowHnd = 0;
std::ostringstream windowHndStr;
OGREWIndow->getCustomAttribute ( "WINDOW", &windowHnd );
windowHndStr << windowHnd;
pl.insert ( std::make_pair ( std::string ( "WINDOW" ), windowHndStr.str() ) );
pl.insert ( std::make_pair ( std::string ( "x11_keyboard_grab" ), "false" ) );
pl.insert ( std::make_pair ( std::string ( "x11_mouse_grab" ), "false" ) );
//pl.insert ( std::make_pair ( std::string ( "x11_mouse_hide" ), "false" ) );
OISInputManager = OIS::InputManager::createInputSystem ( pl );
OISKeyboard = static_cast<OIS::Keyboard *> ( OISInputManager->createInputObject ( OIS::OISKeyboard, true ) );
OISMouse = static_cast<OIS::Mouse *> ( OISInputManager->createInputObject ( OIS::OISMouse, true ) );
updateWindow();
OGRESceneMgr->setAmbientLight ( Ogre::ColourValue ( 0.5f, 0.5f, 0.5f ) );
OISKeyboard->setEventCallback ( this );
OISMouse->setEventCallback ( this );
}
示例2: createInput
void DiInputManager::createInput(DiWndHandle wndhandle, DiWndViewHandle viewhandle)
{
std::ostringstream windowHndStr;
windowHndStr << (ulong)wndhandle;
OIS::ParamList pl;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
pl.insert(std::make_pair(std::string("w32_mouse"), "DISCL_FOREGROUND"));
pl.insert(std::make_pair(std::string("w32_mouse"), "DISCL_NONEXCLUSIVE"));
#if (DEMI_PLATFORM == DEMI_PLATFORM_IOS)
// Pass the view to OIS so the contentScalingFactor can be used
std::ostringstream viewHandleStr;
viewHandleStr << (ulong)viewhandle;
pl.insert(std::make_pair("VIEW", viewHandleStr.str()));
#endif
mInputManager = OIS::InputManager::createInputSystem(pl);
#if DEMI_PLATFORM == DEMI_PLATFORM_IOS
mMultiTouch = static_cast<OIS::MultiTouch*>(mInputManager->createInputObject(OIS::OISMultiTouch, true));
mMultiTouch->setEventCallback(this);
mAccelerometer = static_cast<OIS::JoyStick*>(mInputManager->createInputObject(OIS::OISJoyStick, true));
#elif DEMI_PLATFORM == DEMI_PLATFORM_WIN32 || DEMI_PLATFORM == DEMI_PLATFORM_OSX
mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject(OIS::OISKeyboard, true));
mKeyboard->setEventCallback(this);
mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject(OIS::OISMouse, true));
mMouse->setEventCallback(this);
#endif
}
示例3: Juego
MyFrameListener::MyFrameListener(RenderWindow* win, Camera* cam, SceneManager *sm){
OIS::ParamList param; size_t windowHandle; ostringstream wHandleStr;
_camera = cam;
_sceneManager = sm; _win = win;
_juego = new Juego(sm);
_turno = 1;
_estado = 1;
srand((unsigned)time(NULL)); // Semilla aleatorios
_win->getCustomAttribute("WINDOW", &windowHandle);
wHandleStr << windowHandle;
param.insert(make_pair("WINDOW", wHandleStr.str()));
param.insert(std::make_pair(std::string("x11_mouse_grab"), std::string("false")));
param.insert(std::make_pair(std::string("x11_mouse_hide"), std::string("false")));
_inputManager = OIS::InputManager::createInputSystem(param);
_keyboard = static_cast<OIS::Keyboard*>
(_inputManager->createInputObject(OIS::OISKeyboard, false));
_mouse = static_cast<OIS::Mouse*>
(_inputManager->createInputObject(OIS::OISMouse, false));
_mouse->getMouseState().width = _win->getWidth();
_mouse->getMouseState().height = _win->getHeight();
_mouse->capture();
_raySceneQuery = _sceneManager->createRayQuery(Ray());
}
示例4: getSceneManager
/*
*
* Constructor Frame Listener
*/
MyFrameListener::MyFrameListener(Ogre::RenderWindow* win) {
_idSelectedShip = -1;
_mode = MODE_STARTED;
OIS::ParamList param;
size_t windowHandle; std::ostringstream wHandleStr;
_win = win;
_cam = Ogre::Root::getSingleton().
getSceneManager("mainSM")->getCamera("MainCamera");
_btnIzqPulsado = false;
_rayScnQuery = Ogre::Root::getSingleton().
getSceneManager("mainSM")->createRayQuery(Ogre::Ray(), 0);
_rayScnQueryDD = Ogre::Root::getSingleton().
getSceneManager("mainSM")->createRayQuery(Ogre::Ray(), 0);
win->getCustomAttribute("WINDOW", &windowHandle);
wHandleStr << windowHandle;
param.insert(std::make_pair("WINDOW", wHandleStr.str()));
param.insert(std::make_pair(std::string("x11_mouse_grab"), std::string("false")));
param.insert(std::make_pair(std::string("x11_mouse_hide"), std::string("false")));
param.insert(std::make_pair(std::string("x11_keyboard_grab"), std::string("false")));
param.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true")));
_inputManager = OIS::InputManager::createInputSystem(param);
_keyboard = static_cast<OIS::Keyboard*>
(_inputManager->createInputObject(OIS::OISKeyboard, true));
_mouse = static_cast<OIS::Mouse*> (_inputManager->
createInputObject(OIS::OISMouse, false));
_mouse->getMouseState().width = win->getWidth();
_mouse->getMouseState().height = win->getHeight();
mPlatform = new MyGUI::OgrePlatform();
mPlatform->initialise(win, Ogre::Root::getSingleton().
getSceneManager("mainSM"));
mGUI = new MyGUI::Gui();
mGUI->initialise();
_guiHandler =new GuiInputHandler();
//
_gui = new GuiShip();
_gui->createScene();
_gui->enable();
std::function<void(string)> f_button = std::bind(&MyFrameListener::guiButtonPressed, this, std::placeholders::_1);
_gui->setCallback(f_button);
_points = 0;
}
示例5: setupInput
void Sample::setupInput()
{
size_t winHWND = 0;
mWindow->getCustomAttribute( "WINDOW", &winHWND );
OIS::ParamList paramList;
std::ostringstream windowHndStr;
windowHndStr << winHWND;
paramList.insert(std::make_pair( std::string("WINDOW"), windowHndStr.str()));
paramList.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE")));
paramList.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND")));
// Create input system
mInputSystem = OIS::InputManager::createInputSystem( paramList );
// If possible create a buffered mouse
if( mInputSystem->getNumberOfDevices(OIS::OISMouse) > 0 ) {
mMouse = static_cast<OIS::Mouse*>( mInputSystem->createInputObject( OIS::OISMouse, true ) );
mMouse->setEventCallback( this );
const OIS::MouseState &mouseState = mMouse->getMouseState();
mouseState.width = mWindow->getWidth();
mouseState.height = mWindow->getHeight();
}
// If possible create a buffered keyboard
if( mInputSystem->getNumberOfDevices(OIS::OISKeyboard) > 0 ) {
mKeyboard = static_cast<OIS::Keyboard*>( mInputSystem->createInputObject( OIS::OISKeyboard, true ) );
mKeyboard->setEventCallback( this );
}
}
示例6: initializeEventListeners
void GameCore::initializeEventListeners()
{
//compiled from ogre framework
OIS::ParamList pl;
size_t windowHnd = 0;
std::ostringstream windowHndStr;
renderWindow->getCustomAttribute("WINDOW", &windowHnd);
windowHndStr << windowHnd;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
pl.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true")));
inputManager = OIS::InputManager::createInputSystem( pl );
keyboard = static_cast<OIS::Keyboard*>(inputManager->createInputObject( OISKeyboard, true ));
mouse = static_cast<OIS::Mouse*>(inputManager->createInputObject( OISMouse, true ));
mouse->setEventCallback(this);
keyboard->setEventCallback(this);
windowResized(renderWindow);
Ogre::WindowEventUtilities::addWindowEventListener(renderWindow, this);
}
示例7: initialize
void OISManager::initialize() {
Ogre::LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***");
OIS::ParamList pl;
size_t windowHnd = 0;
std::ostringstream windowHndStr;
Client::getInstance().getOgreManager().getWindow()->getCustomAttribute("WINDOW", &windowHnd);
windowHndStr << windowHnd;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
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")));
inputManager = OIS::InputManager::createInputSystem( pl );
keyboard = static_cast<OIS::Keyboard*>(inputManager->createInputObject( OIS::OISKeyboard, true ));
mouse = static_cast<OIS::Mouse*>(inputManager->createInputObject( OIS::OISMouse, true ));
mouse->setEventCallback(this);
keyboard->setEventCallback(this);
// unsigned int width, height, depth;
// int left, top;
// Client::getInstance().getOgreManager().getWindow()->getMetrics(width, height, depth, left, top);
windowResized(
Client::getInstance().getOgreManager().getWindow());
Ogre::WindowEventUtilities::addWindowEventListener(
Client::getInstance().getOgreManager().getWindow(), this);
DEBUG("!!!!!!!!!!! OIS INITIATE DONE !!!!!!!!!!!");
}
示例8: InitializeOIS
void Game::InitializeOIS(bool useBufferedInput)
{
//Set up logger
Ogre::LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***");
//Initialize OIS
OIS::ParamList pl;
size_t windowHnd = 0;
std::ostringstream windowHndStr;
mWindow->getCustomAttribute("WINDOW", &windowHnd);
windowHndStr << windowHnd;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND" )));
pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE")));
pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_FOREGROUND")));
pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_NONEXCLUSIVE")));
mInputManager = OIS::InputManager::createInputSystem( pl );
mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject( OIS::OISKeyboard, useBufferedInput ));
mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject( OIS::OISMouse, useBufferedInput ));
mKeyboard->setEventCallback(InputNotifier::GetInstance());
mMouse->setEventCallback(InputNotifier::GetInstance());
//Set initial mouse clipping size
windowResized(mWindow);
}
示例9: registerWindow
DInputEventQueue* DInputManager::registerWindow( DRenderWindow* wind, bool isExclusive )
{
EventContextMap::iterator i = mEventContextMap.find(wind);
if (i != mEventContextMap.end())
{
return i->second.eventQueue;
}
// create a new OIS::InputManager
OIS::ParamList pl;
std::ostringstream wnd;
wnd << (size_t)wind->getWindowHandle();
pl.insert(std::make_pair(mPlatform, wnd.str()));
if (!isExclusive)
{
// 非独占模式下鼠标可移出窗口之外
pl.insert(std::make_pair(std::string("w32_mouse"), "DISCL_FOREGROUND"));
pl.insert(std::make_pair(std::string("w32_mouse"), "DISCL_NONEXCLUSIVE"));
}
// since no NULL will be returned, we do not check.
// (OIS will throw exception)
OIS::InputManager* mgr = OIS::InputManager::createInputSystem(pl);
mgr->enableAddOnFactory(OIS::InputManager::AddOn_All);
// since the ois's mouse event depend on its window size, so we must act
// when the window size changed.
wind->signalResized.connect(
DBind(&DInputManager::onWindowResized, this, _1));
DInputEventQueue* queue = new DInputEventQueue();
DInputReceiver* receiver = new DInputReceiver(mgr, queue);
receiver->setWindowSize(wind->getWidth(), wind->getHeight());
mEventContextMap.insert(std::make_pair(wind, EventContext(mgr, receiver, queue)));
return queue;
}
示例10: mInputMgr
scInputManager::scInputManager( u32 handle, u32 width, u32 height, bool isExclusive /*= false*/ )
: mInputMgr(0), mKeyboard(0), mMouse(0), mGuiInput(0),
mKeyPressedLuaState(0), mKeyReleasedLuaState(0),
mMouseMovedLuaState(0), mMousePressedLuaState(0), mMouseReleasedLuaState(0)
{
OIS::ParamList pl;
std::ostringstream windowHndStr;
windowHndStr << handle;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
// 鼠标键盘非独占模式
if (!isExclusive)
{
pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND" )));
pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE")));
pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_FOREGROUND")));
pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_NONEXCLUSIVE")));
}
mInputMgr = OIS::InputManager::createInputSystem(pl);
mKeyboard = static_cast<OIS::Keyboard*>(mInputMgr->createInputObject(OIS::OISKeyboard, true));
mMouse = static_cast<OIS::Mouse*>(mInputMgr->createInputObject(OIS::OISMouse, true));
mMouse->setEventCallback(this);
mKeyboard->setEventCallback(this);
const OIS::MouseState &ms = mMouse->getMouseState();
ms.width = width;
ms.height = height;
}
示例11: init
void InputManager::init(Ogre::RenderWindow* renderWindow, bool isNexclusive)
{
if (!mInputManager)
{
mRenderWindow = renderWindow;
mIsNexclusive = isNexclusive;
OIS::ParamList pl;
size_t windowHnd = 0;
std::ostringstream windowHndStr;
renderWindow->getCustomAttribute("WINDOW", &windowHnd);
windowHndStr << windowHnd;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
if (!isNexclusive)
{
// Under the non-exclusive mode mouse out of the window outside
pl.insert(std::make_pair(std::string("w32_mouse"), "DISCL_FOREGROUND"));
pl.insert(std::make_pair(std::string("w32_mouse"), "DISCL_NONEXCLUSIVE"));
//::ShowCursor(false);
}
mInputManager = OIS::InputManager::createInputSystem( pl );
mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject( OIS::OISKeyboard, true ));
mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject( OIS::OISMouse, true ));
updateMouseExtents(mRenderWindow->getWidth(), mRenderWindow->getHeight());
}
}
示例12: Start
bool Input::Start(Ogre::RenderWindow * win, bool exclusive)
{
window = win;
OIS::ParamList pl;
size_t windowHnd=0;
std::ostringstream windowHndStr;
window->getCustomAttribute("WINDOW", &windowHnd);
windowHndStr << windowHnd;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
if(!exclusive)
{
pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND" )));
pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE")));
}
manager = OIS::InputManager::createInputSystem(pl);
keyboard = static_cast<OIS::Keyboard*>(manager->createInputObject(OIS::OISKeyboard, true));
mouse = static_cast<OIS::Mouse*>(manager->createInputObject(OIS::OISMouse, true));
keyboard->setBuffered(true);
mouse->setBuffered(true);
keyboard->setEventCallback(this);
mouse->setEventCallback(this);
Ogre::WindowEventUtilities::addWindowEventListener(window, this);
windowResized(window);
running = true;
return true;
}
示例13: windowResized
GameFrameListener::GameFrameListener( Ogre::RenderWindow* win ):
m_Window( win ),
m_InputManager( 0 ),
m_Keyboard( 0 )
{
OIS::ParamList pl;
size_t windowHnd = 0;
std::ostringstream windowHndStr;
win->getCustomAttribute( "WINDOW", &windowHnd );
windowHndStr << windowHnd;
pl.insert( std::make_pair( std::string( "WINDOW" ), windowHndStr.str() ) );
#if defined __WIN32__
pl.insert( std::make_pair( std::string( "w32_mouse" ), std::string( "DISCL_FOREGROUND" ) ) );
pl.insert( std::make_pair( std::string( "w32_mouse" ), std::string( "DISCL_NONEXCLUSIVE" ) ) );
#else
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" ) ) );
#endif
m_InputManager = OIS::InputManager::createInputSystem( pl );
m_Keyboard = static_cast< OIS::Keyboard* >( m_InputManager->createInputObject( OIS::OISKeyboard, true ) );
m_Keyboard->setEventCallback( this );
m_Mouse = static_cast< OIS::Mouse* >( m_InputManager->createInputObject( OIS::OISMouse, true ) );
m_Mouse->setEventCallback( this );
windowResized( m_Window );
//Register as a Window listener
Ogre::WindowEventUtilities::addWindowEventListener( m_Window, this );
}
示例14: CreateInputSystem
void HrInputManager::CreateInputSystem()
{
OIS::ParamList pl;
size_t winHandle = 0;
std::ostringstream winHandleStr;
const HrWindowModulePtr& pWindowComponet = HrDirector::Instance()->GetWindowModule();
size_t nWinHandle = (size_t)(pWindowComponet->GetWindowHWnd());
winHandleStr << nWinHandle;
pl.insert(std::make_pair("WINDOW", winHandleStr.str()));
if (true)
{
pl.insert(std::make_pair("w32_mouse", "DISCL_FOREGROUND"));
pl.insert(std::make_pair("w32_mouse", "DISCL_NONEXCLUSIVE"));
pl.insert(std::make_pair("w32_keyboard", "DISCL_FOREGROUND"));
pl.insert(std::make_pair("w32_keyboard", "DISCL_NONEXCLUSIVE"));
}
m_pInputManager = OIS::InputManager::createInputSystem(pl);
mKeyboard = static_cast<OIS::Keyboard*>(m_pInputManager->createInputObject(OIS::OISKeyboard, true));
mMouse = static_cast<OIS::Mouse*>(m_pInputManager->createInputObject(OIS::OISMouse, true));
mMouse->getMouseState().width = pWindowComponet->GetWindowWidth();
mMouse->getMouseState().height = pWindowComponet->GetWindowHeight();
mKeyboard->setEventCallback(&m_inputEventListener);
mMouse->setEventCallback(&m_inputEventListener);
}
示例15:
void
TutorialApplication::initInput()
{
Ogre::LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***");
OIS::ParamList pl;
size_t windowHnd = 0;
std::ostringstream windowHndStr;
mWindow->getCustomAttribute("WINDOW", &windowHnd);
windowHndStr << windowHnd;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND" )));
pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE")));
pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_FOREGROUND")));
pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_NONEXCLUSIVE")));
mInputManager = OIS::InputManager::createInputSystem( pl );
mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject( OIS::OISKeyboard, true ));
mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject( OIS::OISMouse, true ));
mMouse->setEventCallback(this);
mKeyboard->setEventCallback(this);
//Set initial mouse clipping size
windowResized(mWindow);
}