16void scl::windows_input_system::MouseInit()
21 ScreenToClient(*WindowHandle, &pt);
28void scl::windows_input_system::MouseRead()
33 ScreenToClient(*WindowHandle, &pt);
36 Mouse.PosDeltaX = pt.x - Mouse.PosX;
37 Mouse.PosDeltaY = pt.y - Mouse.PosY;
46 Mouse.PosDeltaZ = *Wheel * (!ImGui::GetIO().WantCaptureMouse);
50 else Mouse.PosDeltaZ = 0;
53void scl::windows_input_system::KeyboardInit()
55 if (GetKeyboardState((PBYTE)Keyboard.Keys))
56 memcpy(Keyboard.KeysOld, Keyboard.Keys, 256);
59void scl::windows_input_system::KeyboardRead()
61 memcpy(Keyboard.KeysOld, Keyboard.Keys, 256);
62 bool _ = GetKeyboardState((PBYTE)Keyboard.Keys);
64 ImGuiIO io = ImGui::GetIO();
65 if (io.WantCaptureMouse)
66 Keyboard.Keys[(int)keycode::LBUTTON] =
67 Keyboard.Keys[(
int)keycode::RBUTTON] =
68 Keyboard.Keys[(int)keycode::MBUTTON] = 0;
70 for (INT i = 0; i < 256; i++)
72 Keyboard.Keys[i] >>= 7;
73 Keyboard.KeysClick[i] = Keyboard.Keys[i] && !Keyboard.KeysOld[i];
75 if (io.WantCaptureKeyboard)
77 char lbut = Keyboard.Keys[(int)keycode::LBUTTON];
78 char rbut = Keyboard.Keys[(int)keycode::RBUTTON];
79 char mbut = Keyboard.Keys[(int)keycode::MBUTTON];
81 memset(Keyboard.Keys, 0, 256), memset(Keyboard.KeysClick, 0, 256);
82 Keyboard.Keys[(int)keycode::LBUTTON] = lbut;
83 Keyboard.Keys[(int)keycode::RBUTTON] = rbut;
84 Keyboard.Keys[(int)keycode::MBUTTON] = mbut;
90 this->WindowHandle = WindowHandle;
91 this->Wheel = MouseWheel;
96 if (WindowHandle ==
nullptr || Wheel ==
nullptr)
return;
Sculpto library prehompiled header. Defines common definitions, includes commonly used modules.