Example #1
0
void Modal::ProcessInput()
{
	if (ReadRec.EventType==MOUSE_EVENT)
		ProcessMouse(&ReadRec.Event.MouseEvent);
	else
		ProcessKey(ReadKey);
}
Example #2
0
void SimpleModal::ProcessInput()
{
	if (m_ReadRec.EventType==MOUSE_EVENT && !(m_ReadKey==KEY_MSWHEEL_UP || m_ReadKey==KEY_MSWHEEL_DOWN || m_ReadKey==KEY_MSWHEEL_RIGHT || m_ReadKey==KEY_MSWHEEL_LEFT))
		ProcessMouse(&m_ReadRec.Event.MouseEvent);
	else
		ProcessKey(Manager::Key(m_ReadKey));
}
Example #3
0
	void WinRawInput::ProcessRawInput(MSG& msg)
	{
		UINT dwSize;

		GetRawInputData((HRAWINPUT)msg.lParam, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER));

		if(dwSize > m_inputBufferBytes)
		{
			m_inputBufferBytes = dwSize;

			mem_free(m_inputBuffer);
			m_inputBuffer = (uint8*)mem_alloc(dwSize);
		}

		if (GetRawInputData((HRAWINPUT)msg.lParam, RID_INPUT, m_inputBuffer, &dwSize, sizeof(RAWINPUTHEADER)) != dwSize )
		{
			logger() << "GetRawInputData does not return correct size !\n"; 
			return;
		}

		RAWINPUT* raw = (RAWINPUT*)m_inputBuffer;

		if (raw->header.dwType == RIM_TYPEKEYBOARD) 
		{
			ProcessKeyboard(raw);
		}
		else if (raw->header.dwType == RIM_TYPEMOUSE) 
		{
			ProcessMouse(raw);
		} 
	}
Example #4
0
	LRESULT Process(HWND hWnd, WPARAM wParam, LPARAM lParam) {
		UINT dwSize;
		GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER));
		if (!rawInputBuffer) {
			rawInputBuffer = malloc(dwSize);
			rawInputBufferSize = dwSize;
		}
		if (dwSize > rawInputBufferSize) {
			rawInputBuffer = realloc(rawInputBuffer, dwSize);
		}
		GetRawInputData((HRAWINPUT)lParam, RID_INPUT, rawInputBuffer, &dwSize, sizeof(RAWINPUTHEADER));
		RAWINPUT *raw = (RAWINPUT *)rawInputBuffer;
		bool foreground = GET_RAWINPUT_CODE_WPARAM(wParam) == RIM_INPUT;

		switch (raw->header.dwType) {
		case RIM_TYPEKEYBOARD:
			ProcessKeyboard(raw, foreground);
			break;

		case RIM_TYPEMOUSE:
			ProcessMouse(raw, foreground);
			break;

		case RIM_TYPEHID:
			ProcessHID(raw, foreground);
			break;
		}

		// Docs say to call DefWindowProc to perform necessary cleanup.
		return DefWindowProc(hWnd, WM_INPUT, wParam, lParam);
	}
Example #5
0
void CGUI::Render( void )
{
	// Render the gui
	m_pGUI->Draw();

	// Process the mouse
	ProcessMouse();

	// Render the mouse cursor
	m_pGUI->DrawMouseCursor();

	// Pulse the serverbrowser
	if( m_pServerBrowser )
		m_pServerBrowser->Pulse();
}
void EditorBodyControl::Input(DAVA::UIEvent *event)
{
    bool inputDone = LandscapeEditorInput(event);
    if(!inputDone)
    {
        inputDone = RulerToolInput(event);
    }
    
    if(!inputDone)
    {
        ProcessKeyboard(event);
        ProcessMouse(event);
    }
    
    UIControl::Input(event);
}
void ApplicationClass::Run (void)
{
	//Run the main loop until the exit message is sent
	MSG msg = {0};
	while( WM_QUIT != msg.message )
	{
		if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
		{
			TranslateMessage( &msg );
			DispatchMessage( &msg );
		}
		else
		{
			ProcessKeyboard();
			ProcessMouse();
			ProcessJoystick();
			Update();
			Display();
		}
		Idle();
	}
}
Example #8
0
void GUIwindow::ProcessMSG(UINT imsg, WPARAM wparam, LPARAM lparam)
{
	if (m_vis == false) return;



	bool mouseDown = 0;
	switch (imsg)
	{
		case WM_MOUSEMOVE:
		{
											 mouseX = LOWORD(lparam);
											 mouseY = HIWORD(lparam);
		}
		break;
		case WM_LBUTTONDOWN: 
			mouseDown = 1;
			break;
		case WM_LBUTTONUP: 
			mouseDown = 0;
			break;
		case WM_KEYDOWN:
			//ProcessKey(wparam, lparam);
			break;
		case WM_CHAR:
			ProcessKey(wparam, lparam);
				break;
		case WM_KEYUP:
			break;
		default:
			break;
	}
	ProcessMouse(mouseX, mouseY, mouseDown);


	// process child
	for (int i = 0; i < m_GUIchild.size(); ++i)
		m_GUIchild[i]->ProcessMSG(imsg, wparam, lparam);
}
Example #9
0
void Manager::ProcessMainLoop()
{
	if ( CurrentFrame )
		CtrlObject->Macro.SetMode(CurrentFrame->GetMacroMode());

	if ( CurrentFrame && !CurrentFrame->ProcessEvents() )
	{
		ProcessKey(KEY_IDLE);
	}
	else
	{
		// Mantis#0000073: Не работает автоскролинг в QView
		Global->WaitInMainLoop=IsPanelsActive(true);
		//WaitInFastFind++;
		int Key=GetInputRecord(&LastInputRecord);
		//WaitInFastFind--;
		Global->WaitInMainLoop=FALSE;

		if (EndLoop)
			return;

		if (LastInputRecord.EventType==MOUSE_EVENT && !(Key==KEY_MSWHEEL_UP || Key==KEY_MSWHEEL_DOWN || Key==KEY_MSWHEEL_RIGHT || Key==KEY_MSWHEEL_LEFT))
		{
				// используем копию структуры, т.к. LastInputRecord может внезапно измениться во время выполнения ProcessMouse
				MOUSE_EVENT_RECORD mer=LastInputRecord.Event.MouseEvent;
				ProcessMouse(&mer);
		}
		else
			ProcessKey(Key);
	}

	if(IsPanelsActive())
	{
		if(!Global->PluginPanelsCount)
		{
			CtrlObject->Plugins->RefreshPluginsList();
		}
	}
}
/**-----------------------------------------------------------------------------
 * 입력 처리
 *------------------------------------------------------------------------------
 */
void ProcessInputs( void )
{
	ProcessMouse();
	ProcessKey();
}
/**-----------------------------------------------------------------------------
 * 입력 처리
 *------------------------------------------------------------------------------
 */
void ProcessInputs( void )
{
	ProcessMouse();
	ProcessKey();
	if( g_pBSPTree->DetectCollision( g_pCamera->GetEye() ) ) g_pLog->Log( "Collision detected!" );
}
Example #12
0
void HMenu::ProcessSubMenu(MenuDataEx *Data,int DataCount,
                           const wchar_t *SubMenuHelp,int X,int Y,int &Position)
{
	if (SubMenu)
		delete SubMenu;

	Position=-1;
	SubMenu=new VMenu(L"",Data,DataCount);
	SubMenu->SetFlags(VMENU_NOTCHANGE);
	SubMenu->SetBoxType(SHORT_DOUBLE_BOX);
	SubMenu->SetFlags(VMENU_WRAPMODE);
	SubMenu->SetHelp(SubMenuHelp);
	SubMenu->SetPosition(X,Y,0,0);
	SubMenu->Show();

	while (!SubMenu->Done() && !CloseFARMenu)
	{
		INPUT_RECORD rec;
		int Key;
		Key=GetInputRecord(&rec);

		if (Key==KEY_CONSOLE_BUFFER_RESIZE)
		{
			LockScreen LckScr;
			ResizeConsole();
			Show();
			SubMenu->Hide();
			SubMenu->Show();
		}
		else if (rec.EventType==MOUSE_EVENT)
		{
			if (rec.Event.MouseEvent.dwMousePosition.Y==Y1)
				if (ProcessMouse(&rec.Event.MouseEvent))
				{
					delete SubMenu;
					SubMenu=nullptr;
					return;
				}
			if(Key == KEY_MSWHEEL_UP || Key == KEY_MSWHEEL_DOWN || Key == KEY_MSWHEEL_RIGHT || Key == KEY_MSWHEEL_LEFT)
			{
				SubMenu->ProcessKey(Key);
			}
			else
			{
				SubMenu->ProcessMouse(&rec.Event.MouseEvent);
			}
		}
		else
		{
			if (Key == KEY_LEFT || Key == KEY_RIGHT ||Key == KEY_TAB ||
			        Key == KEY_NUMPAD4 || Key == KEY_NUMPAD6 ||
			        Key == KEY_MSWHEEL_LEFT || Key == KEY_MSWHEEL_RIGHT)
			{
				delete SubMenu;
				SubMenu=nullptr;
				ProcessKey(Key);
				ProcessKey(KEY_ENTER);
				return;
			}

			SubMenu->ProcessKey(Key);
		}
	}

	Position=SubMenu->Modal::GetExitCode();
	delete SubMenu;
	SubMenu=nullptr;
}
Example #13
0
void HMenu::ProcessSubMenu(MenuDataEx *Data,int DataCount,
                           const wchar_t *SubMenuHelp,int X,int Y,int &Position)
{
	Position=-1;
	SubMenu=new VMenu2(L"",Data,DataCount);
	SubMenu->SetBoxType(SHORT_DOUBLE_BOX);
	SubMenu->SetFlags(VMENU_WRAPMODE);
	SubMenu->SetHelp(SubMenuHelp);
	SubMenu->SetPosition(X,Y,0,0);
	SubMenu->SetMacroMode(MACRO_MAINMENU);

	bool SendMouse=false;
	MOUSE_EVENT_RECORD MouseEvent;
	int SendKey=0;

	Position=SubMenu->RunEx([&](int Msg, void *param)->int
	{
		if(Msg!=DN_INPUT)
			return 0;

		INPUT_RECORD &rec=*static_cast<INPUT_RECORD*>(param);
		int Key=InputRecordToKey(&rec);

		if (Key==KEY_CONSOLE_BUFFER_RESIZE)
		{
			LockScreen LckScr;
			ResizeConsole();
			Show();
			return 1;
		}
		else if (rec.EventType==MOUSE_EVENT)
		{
			if (!TestMouse(&rec.Event.MouseEvent))
			{
				MouseEvent=rec.Event.MouseEvent;
				SendMouse=true;
				SubMenu->Close(-1);
				return 1;
			}
			if (rec.Event.MouseEvent.dwMousePosition.Y==Y1)
				return 1;
		}
		else
		{
			if (Key == KEY_LEFT || Key == KEY_RIGHT ||Key == KEY_TAB ||
			        Key == KEY_NUMPAD4 || Key == KEY_NUMPAD6 ||
			        Key == KEY_MSWHEEL_LEFT || Key == KEY_MSWHEEL_RIGHT)
			{
				SendKey=Key;
				SubMenu->Close(-1);
				return 1;
			}
		}
		return 0;
	});

	delete SubMenu;
	SubMenu=nullptr;

	if(SendMouse)
		ProcessMouse(&MouseEvent);
	if(SendKey)
	{
		ProcessKey(SendKey);
		ProcessKey(KEY_ENTER);
	}
}