当前位置: 首页>>代码示例>>C++>>正文


C++ InputManager::createInputObject方法代码示例

本文整理汇总了C++中ois::InputManager::createInputObject方法的典型用法代码示例。如果您正苦于以下问题:C++ InputManager::createInputObject方法的具体用法?C++ InputManager::createInputObject怎么用?C++ InputManager::createInputObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ois::InputManager的用法示例。


在下文中一共展示了InputManager::createInputObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initOIS

void App::initOIS()
{
	OIS::ParamList pl;
    size_t windowHnd = 0;
    std::ostringstream windowHndStr;
 
    // Tell OIS about the Ogre Rendering window (give its id)
    mWindow->getCustomAttribute("WINDOW", &windowHnd);
    windowHndStr << windowHnd;
    pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));

	// Setup the manager, keyboard and mouse to handle input
    OIS::InputManager* inputManager = OIS::InputManager::createInputSystem(pl);
    mKeyboard = static_cast<OIS::Keyboard*>(inputManager->createInputObject(OIS::OISKeyboard, true));
    mMouse = static_cast<OIS::Mouse*>(inputManager->createInputObject(OIS::OISMouse, true));
 
    // Tell OIS about the window's dimensions
    unsigned int width, height, depth;
    int top, left;
    mWindow->getMetrics(width, height, depth, left, top);
    const OIS::MouseState &ms = mMouse->getMouseState();
    ms.width = width;
    ms.height = height;

	// Setup THIS CLASS INSTANCE as a OIS mouse listener AND key listener
	// This means that OIS will call keyPressed(), mouseMoved(), etc.
	// automatically and whenever needed
	mKeyboard->setEventCallback(this);
	mMouse->setEventCallback(this);
}
开发者ID:fakkoweb,项目名称:OgreOculusApp,代码行数:30,代码来源:App.cpp

示例2: initOIS

void App::initOIS()
{
    OIS::ParamList pl;
    size_t windowHnd = 0;
    std::ostringstream windowHndStr;

    //tell OIS about the Ogre window
    mWindow->getCustomAttribute("WINDOW", &windowHnd);
    windowHndStr << windowHnd;
    pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));

    //setup the manager, keyboard and mouse to handle input
    OIS::InputManager* inputManager = OIS::InputManager::createInputSystem(pl);
    mKeyboard = static_cast<OIS::Keyboard*>(inputManager->createInputObject(OIS::OISKeyboard, true));
    mMouse = static_cast<OIS::Mouse*>(inputManager->createInputObject(OIS::OISMouse, true));

    //tell OIS about the window's dimensions
    unsigned int width, height, depth;
    int top, left;
    mWindow->getMetrics(width, height, depth, left, top);
    const OIS::MouseState &ms = mMouse->getMouseState();
    ms.width = width;
    ms.height = height;

    // Make sure OIS calls callbacks (keyPressed, mouseMoved etc) of this class:
    mKeyboard->setEventCallback(this);
    mMouse->setEventCallback(this);
}
开发者ID:lilyrae,项目名称:ShowARoom,代码行数:28,代码来源:App.cpp

示例3: capture

void InputHandler::capture()
{
    if (keyboard == 0 && mouse == 0)
    {
        try {
            keyboard = static_cast<OIS::Keyboard*>
                           (ois->createInputObject(OIS::OISKeyboard, true));
            keyboard->setEventCallback(this);

            mouse = static_cast<OIS::Mouse*>
                        (ois->createInputObject(OIS::OISMouse, true));
            mouse->setEventCallback(this);

            cout << "[libclois-lane] Keyboard and mouse acquired!" << endl;
        } catch (OIS::Exception &e) {
            cout << "[libclois-lane] " << e.eText << endl;
        }
    }
    else
    {
        try {
            keyboard->capture();
            mouse->capture();
	} catch (OIS::Exception &e) {
            cout << "[libclois-lane] " << e.eText << endl;
            keyboard = 0;
            mouse = 0;
        }
    }
}
开发者ID:aerique,项目名称:clois-lane,代码行数:30,代码来源:libclois-lane.cpp

示例4:

	MyFrameListener(RenderWindow* win, Ogre::Camera* Cam ){

		size_t windowHnd = 0;
		std::stringstream windowsHndStr;
		win->getCustomAttribute("WINDOW", &windowHnd);
		windowsHndStr << windowHnd;

		OIS::ParamList pl;
		pl.insert(std::make_pair(std::string("WINDOW"), windowsHndStr.str()));

		_man = OIS::InputManager::createInputSystem(pl);
		_key = static_cast<OIS::Keyboard*>(_man->createInputObject(OIS::OISKeyboard,false));
		_mouse = static_cast<OIS::Mouse*>(_man->createInputObject(OIS::OISMouse,false));
		_cam = Cam;
	}
开发者ID:luiscarlo6,项目名称:Computacion-Grafica-USB,代码行数:15,代码来源:mainProyectoOgreI_base.cpp

示例5:

		AppFrameListener(Ogre::RenderWindow* win, Ogre::Camera* cam, Ogre::SceneManager* _sceneManager){

		OIS::ParamList parameters;
		unsigned int windowHandle = 0;
		std::ostringstream windowHandleString;
		win->getCustomAttribute("WINDOW", &windowHandle);
		windowHandleString << windowHandle;
		parameters.insert(std::make_pair("WINDOW", windowHandleString.str()));
		_InputManager = OIS::InputManager::createInputSystem(parameters);
		_Keyboard = static_cast<OIS::Keyboard*>(_InputManager->createInputObject( OIS::OISKeyboard, false ));
		_Mouse = static_cast<OIS::Mouse*>(_InputManager->createInputObject( OIS::OISMouse, false ));
		_sManager = _sceneManager;
		_Cam = cam;
		_movementspeed = 25;


		}
开发者ID:Isaj7,项目名称:finalOgre,代码行数:17,代码来源:main.cpp

示例6: go

  void go(void)
  {
    // OGRE의 메인 루트 오브젝트 생성
#if !defined(_DEBUG)
    mRoot = new Root("plugins.cfg", "ogre.cfg", "ogre.log");
#else
    mRoot = new Root("plugins_d.cfg", "ogre.cfg", "ogre.log");
#endif


    // 초기 시작의 컨피규레이션 설정 - ogre.cfg 이용
    if (!mRoot->restoreConfig()) {
      if (!mRoot->showConfigDialog()) return;
    }
    mWindow = mRoot->initialise(true, "Hello Professor : Copyleft Dae-Hyun Lee");

    // ESC key를 눌렀을 경우, 오우거 메인 렌더링 루프의 탈출을 처리
	size_t windowHnd = 0;
	std::ostringstream windowHndStr;
	OIS::ParamList pl;
	mWindow->getCustomAttribute("WINDOW", &windowHnd);
	windowHndStr << windowHnd;
	pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
	mInputManager = OIS::InputManager::createInputSystem(pl);
	mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject(OIS::OISKeyboard, false));

	mESCListener = new ESCListener(mKeyboard);
    mRoot->addFrameListener(mESCListener);

	mSceneMgr = mRoot->createSceneManager(ST_GENERIC);

    mCamera = mSceneMgr->createCamera("camera");
    mCamera->setPosition(0.0f, 200.0f, 300.0f);
    mCamera->lookAt(0.0f, 100.0f, 0.00f);
    mCamera->setNearClipDistance(5.0f);

    mViewport = mWindow->addViewport(mCamera);
    mViewport->setBackgroundColour(ColourValue(0.0f,0.0f,0.5f));
    mCamera->setAspectRatio(Real(mViewport->getActualWidth()) / Real(mViewport->getActualHeight()));

    ResourceGroupManager::getSingleton().addResourceLocation("resource.zip", "Zip");
    ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

    mSceneMgr->setAmbientLight(ColourValue(1.0f, 1.0f, 1.0f));

    Entity* daehyunEntity = mSceneMgr->createEntity("Daehyun", "DustinBody.mesh");

    SceneNode* daehyunNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    daehyunNode->attachObject(daehyunEntity);

    mRoot->startRendering();

    mInputManager->destroyInputObject(mKeyboard);
    OIS::InputManager::destroyInputSystem(mInputManager);

    delete mRoot;
  }
开发者ID:AnSuGuen,项目名称:2016-Game-Engine,代码行数:57,代码来源:main.cpp

示例7: initOIS

void App::initOIS()
{
    size_t windowHnd = 0;
    mWindow->getCustomAttribute("WINDOW", &windowHnd);
    std::ostringstream windowHndStr;
	windowHndStr << windowHnd;
	OIS::ParamList pl;
    pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
    OIS::InputManager* inputManager = OIS::InputManager::createInputSystem(pl);
    mKeyboard = static_cast<OIS::Keyboard*>(inputManager->createInputObject(OIS::OISKeyboard, true));
	mKeyboard->setEventCallback(this);
}
开发者ID:ands,项目名称:OculusMeetsAR,代码行数:12,代码来源:App.cpp

示例8: setupInputSystem

    void setupInputSystem()
    {
	   size_t windowHnd = 0;
       std::ostringstream windowHndStr;
       OIS::ParamList pl;
       RenderWindow *win = mWindow;

       win->getCustomAttribute("WINDOW", &windowHnd);
       windowHndStr << windowHnd;
       pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
       mInputManager = OIS::InputManager::createInputSystem(pl);

	   try
       {
           mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject(OIS::OISKeyboard, true));
           mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject(OIS::OISMouse, true));
           //mJoy = static_cast<OIS::JoyStick*>(mInputManager->createInputObject(OIS::OISJoyStick, false));
       }
       catch (const OIS::Exception &e)
       {
           throw Exception(42, e.eText, "Application::setupInputSystem");
       }
    }
开发者ID:RazielXT,项目名称:Autumn-Ashes---legacy-code,代码行数:23,代码来源:AAmain.cpp

示例9: init

void OglOIS::init()
{
	OIS::ParamList pl;
	OIS::InputManager *mInputSystem;

	/*SDL_SysWMinfo info;
	SDL_VERSION( &info.version );
	SDL_GetWindowWMInfo( window, &info );*/
	size_t m_windowHandle;
#if defined OIS_WIN32_PLATFORM
	m_windowHandle = (int) GetActiveWindow();//*(reinterpret_cast<std::size_t*>(&(/*info.info.x11.window*/info.info.win.window)));
#elif defined OIS_LINUX_PLATFORM
	Display *display;
	Window focus;
	int revert;

	display = XOpenDisplay( NULL );
	XGetInputFocus( display, &focus, &revert );
	m_windowHandle = (int) focus;
#endif

	ostringstream windowHndStr;
	windowHndStr << m_windowHandle;
	pl.insert( std::make_pair( std::string( "WINDOW" ), windowHndStr.str( ) ) );

#if defined OIS_WIN32_PLATFORM
	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" ) ) );
#elif defined 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" ) ) );;
#endif

	mInputSystem = OIS::InputManager::createInputSystem( pl );
	mouse = static_cast<OIS::Mouse*>(mInputSystem->createInputObject( OIS::OISMouse, false ));
	keyb = static_cast<OIS::Keyboard*>(mInputSystem->createInputObject( OIS::OISKeyboard, false ));
}
开发者ID:Brejlounek,项目名称:bulletblob,代码行数:37,代码来源:OglOIS.cpp

示例10: Init

void cKeyboard::Init()
{
	// Clear the input buffer
	memset(mabInputBuffer, 0, kuiInputChanelSize);

	assert(cInputManager::Get().mpOISInputManager);
	
	// Creates keyboard object
	OIS::InputManager * lpOISInputManager =cInputManager::Get().mpOISInputManager;
	mpOISKeyboard = (OIS::Keyboard*)lpOISInputManager->createInputObject( OIS::OISKeyboard, true );
	
	// Set callbacks
	mpOISKeyboard->setEventCallback( this );
	mbIsValid = true;
}
开发者ID:Juanmaramon,项目名称:aplicacion-practica-basica,代码行数:15,代码来源:Keyboard.cpp

示例11: catch

JNIEXPORT jlong JNICALL Java_com_badlogic_gdx_controllers_desktop_ois_Ois_createJoystick(JNIEnv* env, jobject object, jlong inputManagerPtr) {


//@line:103

		OIS::InputManager* inputManager = (OIS::InputManager*)inputManagerPtr;
		try {
			return (jlong)static_cast<OIS::JoyStick*>(inputManager->createInputObject(OIS::OISJoyStick, true));
		} catch (std::exception &ex) {
			printf("Error creating joystick: %s\n", ex.what());
			fflush(stdout);
			return 0;
		}
	

}
开发者ID:TerryWalsh123,项目名称:gdxmu,代码行数:16,代码来源:com.badlogic.gdx.controllers.desktop.ois.Ois.cpp

示例12: create_frame_listener

void application::create_frame_listener()
{
    Ogre::LogManager::getSingletonPtr() -> logMessage("Initializing OIS");
    OIS::ParamList pl;
    size_t wndhnd = 0;
    std::ostringstream wndhndstr;

    wnd->getCustomAttribute ("WINDOW", &wndhnd);
    wndhndstr << wndhnd;
    pl.insert (std::make_pair (std::string {"WINDOW"}, wndhndstr.str()));

    input = OIS::InputManager::createInputSystem(pl);

    kbd   = static_cast<OIS::Keyboard*> (input->createInputObject (OIS::OISKeyboard, true));
    mouse = static_cast<OIS::Mouse*>    (input->createInputObject (OIS::OISMouse,    true));

    mouse -> setEventCallback(this);
    kbd   -> setEventCallback(this);

    windowResized(wnd);

    Ogre::WindowEventUtilities::addWindowEventListener (wnd, this);

    OgreBites::InputContext inctx;
    inctx.mMouse    = mouse;
    inctx.mKeyboard = kbd;
    tray_mgr = new OgreBites::SdkTrayManager ("InterfaceName", wnd, inctx, this);
    tray_mgr->showFrameStats(OgreBites::TL_BOTTOMLEFT);
    tray_mgr->showLogo(OgreBites::TL_BOTTOMRIGHT);
    tray_mgr->hideCursor();

    Ogre::StringVector items;
    items.push_back("cam.pX");
    items.push_back("cam.pY");
    items.push_back("cam.pZ");
    items.push_back("");
    items.push_back("cam.oW");
    items.push_back("cam.oX");
    items.push_back("cam.oY");
    items.push_back("cam.oZ");
    items.push_back("");
    items.push_back("Filtering");
    items.push_back("Poly Mode");

    root->addFrameListener(this);
}
开发者ID:vcu-cmsc451-1,项目名称:Senior-Design-Project,代码行数:46,代码来源:application.hpp

示例13: setup

bool App::setup ()
{
	// Set up the input manager
	input_manager = OIS::InputManager::createInputSystem(window.getSystemHandle());
	
	// Joystick
	cout << input_manager->getNumberOfDevices(OIS::OISJoyStick) << " joysticks" << endl;
	OIS::DeviceList::iterator it = input_manager->listFreeDevices().begin();
	OIS::DeviceList::iterator end = input_manager->listFreeDevices().end();
	for (; it!=end; it++) {
		cout << it->first << ", " << it->second << endl;
	}
	
	joystick = static_cast<OIS::JoyStick*>(input_manager->createInputObject(OIS::OISJoyStick, true));
	joystick->setEventCallback(this);
	
	return true;
}
开发者ID:dustyco,项目名称:sfmlframework,代码行数:18,代码来源:joy.cpp

示例14: WinMain


//.........这里部分代码省略.........
    Shader* waterShader = Renderer::GetInstance()->CreateShader();
    waterShader->SetSourceFile("Shaders/vert", "Shaders/frag");

    Material waterMaterial(waterShader);
    Texture2D* waterTexture = Renderer::GetInstance()->CreateTexture2DFromFile("Media/water.jpg");
    waterMaterial.SetUniformTexture("waterTexture", waterTexture);

    // Water node
    Node waterNode;
    waterNode.SetMaterial(&waterMaterial);
    waterNode.SetMesh(&waterMesh);
    Renderer::GetInstance()->GetSceneTree().AddNode(&waterNode);

    Renderer::GetInstance()->CameraLookAt(Vector3(0.0f, 0.0f, -3.5f), Vector3::ZERO);

    // Create the OIS system if present
#ifdef OIS_AVAILABLE

    size_t windowHandle = (size_t)window.GetHandle();

    OIS::ParamList paramList;
    paramList.insert(pair<string, string>("WINDOW", to_string(windowHandle)));

#if defined OIS_WIN32_PLATFORM
    paramList.insert(pair<string, string>("w32_mouse", "DISCL_FOREGROUND"));
    paramList.insert(pair<string, string>("w32_mouse", "DISCL_NONEXCLUSIVE"));
#elif defined OIS_LINUX_PLATFORM
    paramList.insert(pair<string, string>("x11_mouse_grab", "false"));
    paramList.insert(pair<string, string>("x11_mouse_hide", "false"));
#endif

    OIS::InputManager* inputManager = OIS::InputManager::createInputSystem(paramList);

    OIS::Keyboard* keyboard = static_cast<OIS::Keyboard*>(inputManager->createInputObject(OIS::OISKeyboard, false));
    OIS::Mouse* mouse = static_cast<OIS::Mouse*>(inputManager->createInputObject(OIS::OISMouse, false));

    const OIS::MouseState& ms = mouse->getMouseState();
    ms.width = window.GetWidth();
    ms.height = window.GetHeight();
#endif

    //Renderer::GetInstance()->SetRenderFillMode(RENDER_MODE_WIREFRAME);
    float splashForce = 0.1f;
    float damping = 0.999f;
    float maxHeight = 0.15f;

    while (window.IsOpen()) {
        WindowEvent windowEvent;
        if (window.PollEvents(windowEvent)) {
        }

        // Poll the mouse if OIS is present
#ifdef OIS_AVAILABLE
        keyboard->capture();

        if (keyboard->isKeyDown(OIS::KC_ESCAPE)) {
            break;
        }

        mouse->capture();

        // If we clicked on the surface, get the point on the water plane and send it to the shader
        // for it to compute the ripples

        if (mouse->getMouseState().buttonDown(OIS::MB_Left)) {
            Vector3 pos = Renderer::GetInstance()->ScreenToWorldPoint(Vector2((float)mouse->getMouseState().X.abs, (float)mouse->getMouseState().Y.abs));
开发者ID:gviau,项目名称:sketch-3d,代码行数:67,代码来源:Main.cpp

示例15: initialise

    bool initialise()
    {
		mRoot = new Ogre::Root(PLUGINS_CFG, OGRE_CFG, OGRE_LOG);

		if (!mRoot->restoreConfig())
			if (!mRoot->showConfigDialog())
				return false;

		initResources();

        mWindow = mRoot->initialise(true, "CS Clone Editor v0.0");
        Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this);

		mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC);
		mSceneMgr->setAmbientLight(Ogre::ColourValue(0.7, 0.7, 0.7));
		mCamera = mSceneMgr->createCamera("camera");
        mWindow->addViewport(mCamera);
        mCamera->setAutoAspectRatio(true);
        mCamera->setNearClipDistance(0.1);
        mCamera->setFarClipDistance(10000);
        mCamera->setPosition(10, 10, 10);
//        mCamera->lookAt(0, 0, 0);

        mRoot->addFrameListener(this);

		Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
//Initializing OIS
		Ogre::LogManager::getSingletonPtr()->logMessage("*-*-* OIS Initialising");

		OIS::ParamList pl;
		size_t windowHnd = 0;
		mWindow->getCustomAttribute("WINDOW", &windowHnd);
		pl.insert(std::make_pair(std::string("WINDOW"), Ogre::StringConverter::toString(windowHnd)));

#if OGRE_DEBUG_MODE == 1
	#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
		#define NO_EXCLUSIVE_INPUT
	#endif
#endif

#ifdef NO_EXCLUSIVE_INPUT
	#if defined OIS_WIN32_PLATFORM
		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")));
	#elif defined 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
#endif
		mInputManager = OIS::InputManager::createInputSystem(pl);

		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);

		windowResized(mWindow);
//Initialising GUI
		Ogre::LogManager::getSingletonPtr()->logMessage("*-*-* MyGUI Initialising");
		mGUI = new MyGUI::Gui;
		mGUI->initialise(mWindow);
		mGUI->load("editor.layout");

		mMenuBar = mGUI->createWidget<MyGUI::MenuBar>("MenuBar",
			MyGUI::IntCoord(0, 0, mGUI->getViewWidth(), 28),
			MyGUI::ALIGN_TOP | MyGUI::ALIGN_HSTRETCH, "Overlapped");

		mMenuBar->addItem("File");
		mPopupMenuFile = mMenuBar->getItemMenu(0);
		mPopupMenuFile->addItem("New");
		mPopupMenuFile->addItem("Open ...");
		mPopupMenuFile->addItem("Save");
		mPopupMenuFile->addItem("Save as ...", false, true);
		mPopupMenuFile->addItem("Settings", false, true);
		mPopupMenuFile->addItem("Quit");

		mMenuBar->addItem("Help");
		mPopupMenuHelp = mMenuBar->getItemMenu(1);
		mPopupMenuHelp->addItem("Help");
		mPopupMenuHelp->addItem("About ...");

		return (true);
    }
开发者ID:ItzFluffy,项目名称:csclone,代码行数:87,代码来源:editor.cpp


注:本文中的ois::InputManager::createInputObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。