Esempio n. 1
0
void Input::dragMouse(int x, int y){

	#ifdef TARGET_WIN32

        bShiftDown=((GetKeyState( VK_SHIFT ) & 0x80) > 0);
        bCtrlDown=((GetKeyState( VK_CONTROL ) & 0x80) > 0);
        bAltDown=((GetKeyState( VK_MENU ) & 0x80) > 0);

	#endif

	#ifdef TARGET_MACOSX

		bShiftDown=CGEventSourceKeyState(0,(CGKeyCode)56);
		bCtrlDown=CGEventSourceKeyState(0,(CGKeyCode)59);

	#endif

    #ifdef TARGET_LINUX
        bShiftDown=false;
        bCtrlDown=false;
        if (glutGetModifiers()==GLUT_ACTIVE_SHIFT)
            bShiftDown=true;
        if (glutGetModifiers()==GLUT_ACTIVE_CTRL)
            bCtrlDown=true;
    #endif


	if (dragButton && dragButton->bDragable){
	  dragButton->mouseDrag();
	  }
	else if (hudTarget && hudTarget->bDragable)
	  hudTarget->mouseDrag();

	//delta
	mouseVector.x=x-mouseX;//yay!
	mouseVector.y=(y-mouseY)*sceneData->invertMouse;

	mouseX=x;
	mouseY=y;


    #ifdef TARGET_LINUX
    //mouse confinement is kinda broken in LINUX
    return;
    #endif

	if (bConfineMouse){

       if (mouseX>renderer->screenX/2+200 || mouseX < renderer->screenX/2-200)
                confineMouse();

       if (mouseY>renderer->screenY/2+200 || mouseY < renderer->screenY/2-200)
                confineMouse();

        bConfineMouse=false;
    }
}
Esempio n. 2
0
bool wxGetKeyState (wxKeyCode key)
{
    wxASSERT_MSG(key != WXK_LBUTTON && key != WXK_RBUTTON && key !=
                 WXK_MBUTTON, wxT("can't use wxGetKeyState() for mouse buttons"));

    CGKeyCode cgcode = wxCharCodeWXToOSX((wxKeyCode)key);
    return CGEventSourceKeyState(kCGEventSourceStateCombinedSessionState, cgcode);
}