DirectX Mouseinput



  • hallo ihe lieben :),

    ich habe ein kleines problem mit dem mousebutton input. undzwar wird der mousebutton immer nur als gedrückt behandelt, wenn sich die maus bewegt, ich brauche ihn aber auch , wenn sich die maus nicht bewegt. mein code sieht folgendermaßen aus :

    LRESULT TestApp::MsgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
    	//LEFT KEY
    	LeftMouseButton.WasDown = LeftMouseButton.IsDown;
    	LeftMouseButton.IsDown = false;
    	LeftMouseButton.IsReleased = false;
    	//
    
    	//RIGHT KEY
    	RightMouseButton.WasDown = RightMouseButton.IsDown;
    	RightMouseButton.IsDown = false;
    	RightMouseButton.IsReleased = false;
    	//
    
    	MouseMoved = false;
    
    	switch (msg)
    	{
    	case WM_DESTROY:
    		PostQuitMessage(0);
    		return 0;
    
    	case WM_MOUSEMOVE:
    		GetCursorPos(&curserPos);
    		MouseMoved = true;
    
    	case WM_KEYDOWN:
    		switch (wParam)
    		{
    			//F1 KEY
    		case VK_F1:
    			m_bHandleDeviceLost = !m_bHandleDeviceLost;
    			return 0;
    			break;
    
    			//F2 KEY
    		case VK_F2:
    			CameraPos = D3DXVECTOR3(0.0f, 0.0f, -6.0f);
    			CameraTarget = D3DXVECTOR3(0.0f, -5.0f, 1.0f);
    			break;
    
    			//F11 KEY
    		case VK_F11:
    			PostQuitMessage(0);
    			break;
    
    			//MULTIPLY KEY
    		case VK_MULTIPLY:
    			m_pDevice3D->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
    			break;
    
    			//DIVIDE KEY
    		case VK_DIVIDE:
    			if (SwitchState(lighted))
    				m_pDevice3D->SetRenderState(D3DRS_LIGHTING, false);
    			else
    				m_pDevice3D->SetRenderState(D3DRS_LIGHTING, true);
    			break;
    
    			//ADD KEY
    		case VK_ADD:
    			CameraPos.y += 0.2f;
    			CameraTarget.y += 0.2f;
    			break;
    
    			//MINUS KEY
    		case VK_SUBTRACT:
    			CameraPos.y -= 0.2f;
    			CameraTarget.y -= 0.2f;
    			break;
    
    			//UP KEY
    		case VK_UP:
    			CameraPos.z += 0.2f;
    			CameraTarget.z += 0.2f;
    			break;
    
    			//DOWN KEY
    		case VK_DOWN:
    			CameraPos.z -= 0.2f;
    			CameraTarget.z -= 0.2f;
    			break;
    
    			//RIGHT KEY
    		case VK_RIGHT:
    			CameraPos.x += 0.2f;
    			CameraTarget.x += 0.2f;
    			break;
    
    			//LEFT KEY
    		case VK_LEFT:
    			CameraPos.x -= 0.2f;
    			CameraTarget.x -= 0.2f;
    			break;
    
    			//NUMPAD1 KEY
    		case VK_NUMPAD1:
    			lantern1->SetGlowingState(false, d3dColors::Green, d3dColors::Green, m_pDevice3D);
    			lantern2->SetGlowingState(false, d3dColors::Green, d3dColors::Green, m_pDevice3D);
    			lantern3->SetGlowingState(false, d3dColors::Green, d3dColors::Green, m_pDevice3D);
    			break;
    
    			//LEFT MOUSE BUTTON
    		case VK_LBUTTON:
    			LeftMouseButton.IsDown = true;
    			break;
    
    			//NUMPAD1 KEY
    		case LK_E:
    			SwitchState(SystemCls->active);
    			break;
    
    		//	//NUMPAD1 KEY
    		case VK_NUMPAD8:
    			if (SystemCls->active)
    				SystemCls->InfoOutSprite->SetPosition((SystemCls->InfoOutSprite->GetPosition(*"x") + 10), (SystemCls->InfoOutSprite->GetPosition(*"y") + 10), (SystemCls->InfoOutSprite->GetPosition(*"z")));
    			break;
    		}
    		if (LeftMouseButton.IsDown != LeftMouseButton.WasDown && LeftMouseButton.WasDown == true)
    			LeftMouseButton.IsReleased = true;
    		if (RightMouseButton.IsDown != RightMouseButton.WasDown && RightMouseButton.WasDown == true)
    			RightMouseButton.IsReleased = true;
    		return 0;
    	}
    	LeftMouseButton.IsDown = false;
    	if (LeftMouseButton.IsDown != LeftMouseButton.WasDown && LeftMouseButton.WasDown == true)
    		LeftMouseButton.IsReleased = true;
    	if (RightMouseButton.IsDown != RightMouseButton.WasDown && RightMouseButton.WasDown == true)
    		RightMouseButton.IsReleased = true;
    	return DefWindowProc(hwnd, msg, wParam, lParam);
    };
    

    vllt könnt ihr mir ja weiterhelfen.
    schonmal vielen dank für eure hilfe,
    liebe gürße whiletruedo


Log in to reply