예제 #1
0
bool InputManager::InputListener::mousePressed(const OIS::MouseEvent &o, OIS::MouseButtonID id)
{	
	_mouseKey[id] = InputManager::InputListener::stateKey::KEYDOWN;
	CEGUI::GUIContext&context = CEGUI::System::getSingleton().getDefaultGUIContext();
	context.injectMouseButtonDown(convertButton(id));
	context.injectChar(convertButton(id));
	return true;
}
예제 #2
0
//This is a bad implementation 
//They have a bette approach 
//First read the key into firstKey    ( if first read faild, give up immediately)
//Second reread the key into secondKey 
//if they are the same so it is pressed 
//if not return NON
enum BUTTON_TYPE getKeyPressed( void )
{
#ifndef KEY_PORT
#error "No KEY_PORT defined function getKeyPressed() can't work!!"
#endif

	unsigned char x_temp,y_temp;

	KEY_PORT = 0x0F;

	x_temp = KEY_PORT;

	KEY_PORT = 0xF0;

	y_temp = KEY_PORT;

	x_temp = x_temp | y_temp;
	
	x_temp = ~x_temp;

	//wait for user to release the key
	do
	{
		KEY_PORT = 0xF0;         //can/should I use delay here?? If I have an operating system , it will be very easy, set a wait and let other run. when timeout check the value if fail..continue wait...
	}
	while( KEY_PORT != 0xF0 );
	
	
	return ( convertButton(x_temp) );
}
예제 #3
0
bool llm::InputListener::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id){
	if(llm::Application::getInstance()->inGame()){

	} else {
		CEGUI::System::getSingleton().injectMouseButtonUp(convertButton(id));
	}
    return true;
}
예제 #4
0
bool InputListener::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id)
{
  CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonUp(convertButton(id));
  if (id == OIS::MB_Left && this->_Game->getTeleportActivated())
  {
    this->_Game->setTeleportActivated(false);
    this->_WormsApp->getUIManager()->desactivateCursor();
  }
  return true;
}
예제 #5
0
	bool 
	GUIManager::mouseReleased(const OIS::MouseEvent& evt, OIS::MouseButtonID id)
	{
		/* normal mouse processing here... */
		//if(mInputHandler->godMode == true){
		//	mTankWarCamera->mCameraMan->injectMouseUp(evt, id);
		//}

		CEGUI::System::getSingleton().injectMouseButtonUp(convertButton(id));

		return true;
	}
예제 #6
0
bool crClient::mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id) {
    CEGUI::System::getSingleton().injectMouseButtonUp(convertButton(id));

    switch(id) {
        case OIS::MB_Left:
            break;
        default:
            break;
    }

    return true;
}
bool OgreWindowInputManager::mouseReleased(const OIS::MouseEvent& arg,
        OIS::MouseButtonID id)
{
    if (m_injectMouse)
        CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonUp(
                convertButton(id));
    for (OIS::MouseListener *l : m_mouseListeners)
    {
        if (!l->mouseReleased(arg, id))
            return false;
    }
    return true;
}
예제 #8
0
bool graphics::OgreEngine::mouseReleased(const OIS::MouseEvent& e, OIS::MouseButtonID id)
{
  try
    {
      CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonUp(convertButton(id));
      engine::StateManager::getSingleton().onMouseUp(e,id);
    }
  catch(const luabind::error& e)
    {
      luabind::object error_msg(luabind::from_stack(e.state(), -1));
      std::cout << "Lua runtime error: " << error_msg << std::endl;
      throw std::runtime_error("");
    }
  return true;
}
예제 #9
0
bool llm::InputListener::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id) {
	llm::Application* app = llm::Application::getInstance();

	Ogre::Ray mouseRay = app->game()->camera()->getCameraToViewportRay( e.state.X.abs / float(e.state.width ), e.state.Y.abs / float( e.state.height ) );
 	m_pRaySceneQuery->setRay( mouseRay );

	if( app->inGame() ){
		if( id == OIS::MB_Left ) {
			app->game()->cubeHit( e.state.X.abs, e.state.Y.abs );
		} 
	} else {
		CEGUI::System::getSingleton().injectMouseButtonDown(convertButton(id));
	}
    return true; 
}
예제 #10
0
bool App::mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
{
	CEGUI::System::getSingleton().injectMouseButtonUp(convertButton(id));
	//
	if (id == OIS::MB_Left)
	{
		mLMouseDown = false;
	}
	else if (id == OIS::MB_Right)
	{
		CEGUI::MouseCursor::getSingleton().show();
		mRMouseDown = false;
	}
	//
    return true;
}
예제 #11
0
bool crClient::mousePressed(const OIS::MouseEvent &arg, OIS::MouseButtonID id) {
    CEGUI::System::getSingleton().injectMouseButtonDown(convertButton(id));

    switch(id) {
        case OIS::MB_Left:
            break;
        case OIS::MB_Right:
            if(avMouseLook) {
                CEGUI::MouseCursor::getSingleton().show();
                CEGUI::MouseCursor::getSingleton().setPosition(CEGUI::Point(arg.state.width / 2, arg.state.height / 2));
                avMouseLook = false;
            } else {
                CEGUI::MouseCursor::getSingleton().hide();
                avMouseLook = true;
            }
            break;
        default:
            break;
    }

    return true;
}
예제 #12
0
//-------------------------------------------------------------------------------------
bool MenuApp::mousePressed( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
{
  CEGUI::System::getSingleton().injectMouseButtonDown(convertButton(id));
  return true;
}
예제 #13
0
bool InputManager::InputListener::mouseReleased(const OIS::MouseEvent &o, OIS::MouseButtonID id)
{
	_mouseKey[id] = InputManager::InputListener::stateKey::KEYUP;
	CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonUp(convertButton(id));
	return true;
}
예제 #14
0
OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event)
{
	OSStatus err = eventNotHandledErr;
	GHOST_IWindow *window = m_windowManager->getActiveWindow();
	UInt32 kind = ::GetEventKind(event);
			
	switch (kind)
	{
		case kEventMouseDown:
		case kEventMouseUp:
			// Handle Mac application responsibilities
			if ((kind == kEventMouseDown) && handleMouseDown(event)) {
				err = noErr;
			}
			else {
				GHOST_TEventType type = (kind == kEventMouseDown) ? GHOST_kEventButtonDown : GHOST_kEventButtonUp;
				EventMouseButton button;
				
				/* Window still gets mouse up after command-H */
				if (m_windowManager->getActiveWindow()) {
					// handle any tablet events that may have come with the mouse event (optional)
					handleTabletEvent(event);
					
					::GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button);
					pushEvent(new GHOST_EventButton(getMilliSeconds(), type, window, convertButton(button)));
					err = noErr;
				}
			}
			break;
			
		case kEventMouseMoved:
		case kEventMouseDragged: {
			Point mousePos;

			if (window) {
				//handle any tablet events that may have come with the mouse event (optional)
				handleTabletEvent(event);

				::GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &mousePos);
				pushEvent(new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, mousePos.h, mousePos.v));
				err = noErr;
			}
			break;
		}
		case kEventMouseWheelMoved:
		{
			OSStatus status;
			//UInt32 modifiers;
			EventMouseWheelAxis axis;
			SInt32 delta;
			//status = ::GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifiers), NULL, &modifiers);
			//GHOST_ASSERT(status == noErr, "GHOST_SystemCarbon::handleMouseEvent(): GetEventParameter() failed");
			status = ::GetEventParameter(event, kEventParamMouseWheelAxis, typeMouseWheelAxis, NULL, sizeof(axis), NULL, &axis);
			GHOST_ASSERT(status == noErr, "GHOST_SystemCarbon::handleMouseEvent(): GetEventParameter() failed");
			if (axis == kEventMouseWheelAxisY)
			{
				status = ::GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(delta), NULL, &delta);
				GHOST_ASSERT(status == noErr, "GHOST_SystemCarbon::handleMouseEvent(): GetEventParameter() failed");
				/*
				 * Limit mouse wheel delta to plus and minus one.
				 */
				delta = delta > 0 ? 1 : -1;
				pushEvent(new GHOST_EventWheel(getMilliSeconds(), window, delta));
				err = noErr;
			}
		}
		break;
	}
	
	return err;
}
예제 #15
0
bool GHOST_SystemCarbon::handleMouseDown(EventRef event)
{
	WindowPtr window;
	short part;
	BitMap screenBits;
	bool handled = true;
	GHOST_WindowCarbon *ghostWindow;
	Point mousePos = {0, 0};
	
	::GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &mousePos);
	
	part = ::FindWindow(mousePos, &window);
	ghostWindow = (GHOST_WindowCarbon *) ::GetWRefCon(window);
	
	switch (part) {
		case inMenuBar:
			handleMenuCommand(::MenuSelect(mousePos));
			break;
			
		case inDrag:
			/*
			 * The DragWindow() routine creates a lot of kEventWindowBoundsChanged
			 * events. By setting m_ignoreWindowSizedMessages these are suppressed.
			 * \see GHOST_SystemCarbon::handleWindowEvent(EventRef event)
			 */
			/* even worse: scale window also generates a load of events, and nothing 
			 * is handled (read: client's event proc called) until you release mouse (ton) */
			
			GHOST_ASSERT(validWindow(ghostWindow), "GHOST_SystemCarbon::handleMouseDown: invalid window");
			m_ignoreWindowSizedMessages = true;
			::DragWindow(window, mousePos, &GetQDGlobalsScreenBits(&screenBits)->bounds);
			m_ignoreWindowSizedMessages = false;
			
			pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowMove, ghostWindow) );

			break;
		
		case inContent:
			if (window != ::FrontWindow()) {
				::SelectWindow(window);
				/*
				 * We add a mouse down event on the newly actived window
				 */		
				//GHOST_PRINT("GHOST_SystemCarbon::handleMouseDown(): adding mouse down event, " << ghostWindow << "\n");
				EventMouseButton button;
				::GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button);
				pushEvent(new GHOST_EventButton(getMilliSeconds(), GHOST_kEventButtonDown, ghostWindow, convertButton(button)));
			}
			else {
				handled = false;
			}
			break;
			
		case inGoAway:
			GHOST_ASSERT(ghostWindow, "GHOST_SystemCarbon::handleMouseEvent: ghostWindow==0");
			if (::TrackGoAway(window, mousePos))
			{
				// todo: add option-close, because it's in the HIG
				// if (event.modifiers & optionKey) {
				// Close the clean documents, others will be confirmed one by one.
				//}
				// else {
				pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowClose, ghostWindow));
				//}
			}
			break;
			
		case inGrow:
			GHOST_ASSERT(ghostWindow, "GHOST_SystemCarbon::handleMouseEvent: ghostWindow==0");
			::ResizeWindow(window, mousePos, NULL, NULL);
			break;
			
		case inZoomIn:
		case inZoomOut:
			GHOST_ASSERT(ghostWindow, "GHOST_SystemCarbon::handleMouseEvent: ghostWindow==0");
			if (::TrackBox(window, mousePos, part)) {
				int macState;
				
				macState = ghostWindow->getMac_windowState();
				if (macState == 0)
					::ZoomWindow(window, part, true);
				else 
				if (macState == 2) {     // always ok
					::ZoomWindow(window, part, true);
					ghostWindow->setMac_windowState(1);
				}
				else {       // need to force size again
					//	GHOST_TUns32 scr_x,scr_y; /*unused*/
					Rect outAvailableRect;
						
					ghostWindow->setMac_windowState(2);
					::GetAvailableWindowPositioningBounds(GetMainDevice(), &outAvailableRect);
						
					//this->getMainDisplayDimensions(scr_x,scr_y);
					::SizeWindow(window, outAvailableRect.right - outAvailableRect.left, outAvailableRect.bottom - outAvailableRect.top - 1, false);
					::MoveWindow(window, outAvailableRect.left, outAvailableRect.top, true);
				}
				
			}
			break;

		default:
			handled = false;
			break;
	}
	
	return handled;
}
예제 #16
0
 bool TutorialApplication::mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id)
{
	CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonUp(convertButton(id));
	mCameraMan->injectMouseUp(arg, id);
    return true;
}
예제 #17
0
bool InputListener::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id)
{
  CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonDown(convertButton(id));
  return true;
}
예제 #18
0
bool GUIManager::injectMouseReleased( const OIS::MouseEvent &e, OIS::MouseButtonID id )
{
	mHikariMgr->injectMouseUp(convertButton(id));

	return true;
}
예제 #19
0
bool Game::mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id)
{
	CEGUI::System::getSingleton().injectMouseButtonUp(convertButton(id));
	return true;
}
예제 #20
0
bool graphics::OgreEngine::mousePressed(const OIS::MouseEvent& e, OIS::MouseButtonID id)
{
  CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonDown(convertButton(id));
  engine::StateManager::getSingleton().onMouseDown(e,id);
  return true;
}