MCPcopy Create free account
hub / github.com/aliasIsolation/aliasIsolation / WndProcHandler

Method WndProcHandler

src/dll/menu.cpp:38–129  ·  view source on GitHub ↗

Our custom window handler to override A:I's own handler. This lets us detect keyboard inputs and pass mouse + keyboard input control to ImGui.

Source from the content-addressed store, hash-verified

36// Our custom window handler to override A:I's own handler.
37// This lets us detect keyboard inputs and pass mouse + keyboard input control to ImGui.
38LRESULT CALLBACK Menu::WndProcHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
39{
40 ImGuiIO &io = ImGui::GetIO();
41 if (uMsg == WM_KEYDOWN)
42 {
43 if (wParam == VK_DELETE)
44 {
45 g_showMenu = !g_showMenu;
46
47 if (g_showMenu)
48 {
49 ClipCursor(NULL);
50 ShowCursor(true);
51 }
52 else
53 {
54 RECT windowRect;
55 GetClientRect(hWnd, &windowRect);
56 MapWindowPoints(hWnd, NULL, reinterpret_cast<LPPOINT>(&windowRect), 2);
57 ClipCursor(&windowRect);
58 ShowCursor(false);
59 }
60
61 return true;
62 }
63 }
64
65 if (g_showMenu)
66 {
67 switch (uMsg)
68 {
69 case WM_LBUTTONDOWN:
70 io.MouseDown[0] = true;
71 return true;
72 case WM_LBUTTONUP:
73 io.MouseDown[0] = false;
74 return true;
75 case WM_RBUTTONDOWN:
76 io.MouseDown[1] = true;
77 return true;
78 case WM_RBUTTONUP:
79 io.MouseDown[1] = false;
80 return true;
81 case WM_MBUTTONDOWN:
82 io.MouseDown[2] = true;
83 return true;
84 case WM_MBUTTONUP:
85 io.MouseDown[2] = false;
86 return true;
87 case WM_XBUTTONDOWN:
88 if ((GET_KEYSTATE_WPARAM(wParam) & MK_XBUTTON1) == MK_XBUTTON1)
89 io.MouseDown[3] = true;
90 else if ((GET_KEYSTATE_WPARAM(wParam) & MK_XBUTTON2) == MK_XBUTTON2)
91 io.MouseDown[4] = true;
92 return true;
93 case WM_XBUTTONUP:
94 if ((GET_KEYSTATE_WPARAM(wParam) & MK_XBUTTON1) == MK_XBUTTON1)
95 io.MouseDown[3] = false;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected