1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
		while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&msg);
			if (msg.message == WM_INPUT)
			{
				unsigned __int32 dwSize;
				GetRawInputData((HRAWINPUT__*)msg.lParam, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER));
			
				unsigned char *lpb = new unsigned char[dwSize];
				GetRawInputData((HRAWINPUT__*)msg.lParam, RID_INPUT, lpb, &dwSize, sizeof(RAWINPUTHEADER));
			
				tagRAWINPUT* raw = (tagRAWINPUT*)lpb;
				InputSystem::handleRawMessage(raw);

				delete[] lpb;
			} else {
				DefWindowProc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
			}
		}

		LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
		{
			return DefWindowProc(hWnd, message, wParam, lParam);
		}