Change dvar description, static_assert size, style fix

This commit is contained in:
GEEKiDoS 2022-05-03 10:11:02 +08:00
parent 2d79f10b37
commit 1b6a852d07
3 changed files with 7 additions and 8 deletions

View File

@ -92,7 +92,7 @@ namespace Components
// Don't use raw input for menu? // Don't use raw input for menu?
// Because it needs to call the ScreenToClient // Because it needs to call the ScreenToClient
static tagPOINT curPos; tagPOINT curPos;
GetCursorPos(&curPos); GetCursorPos(&curPos);
Game::s_wmv->oldPos = curPos; Game::s_wmv->oldPos = curPos;
ScreenToClient(Game::g_wv->hWnd, &curPos); ScreenToClient(Game::g_wv->hWnd, &curPos);
@ -108,9 +108,7 @@ namespace Components
void RawMouse::IN_RawMouse_Init() void RawMouse::IN_RawMouse_Init()
{ {
static auto init = false; if (Game::g_wv->hWnd && RawMouse::M_RawInput.get<bool>())
if (Game::g_wv->hWnd && !init && RawMouse::M_RawInput.get<bool>())
{ {
#ifdef DEBUG #ifdef DEBUG
Logger::Print("Raw Mouse Init.\n"); Logger::Print("Raw Mouse Init.\n");
@ -123,8 +121,6 @@ namespace Components
Rid[0].hwndTarget = Game::g_wv->hWnd; Rid[0].hwndTarget = Game::g_wv->hWnd;
RegisterRawInputDevices(Rid, ARRAYSIZE(Rid), sizeof(Rid[0])); RegisterRawInputDevices(Rid, ARRAYSIZE(Rid), sizeof(Rid[0]));
init = true;
} }
} }
@ -157,7 +153,7 @@ namespace Components
Dvar::OnInit([]() Dvar::OnInit([]()
{ {
RawMouse::M_RawInput = Dvar::Register<bool>("m_rawinput", true, Game::dvar_flag::DVAR_ARCHIVE, "Use raw mouse input, use in_restart to take effect if not enabled."); RawMouse::M_RawInput = Dvar::Register<bool>("m_rawinput", true, Game::dvar_flag::DVAR_ARCHIVE, "Use raw mouse input, Improves accuracy & has better support for higher polling rates. Use in_restart to take effect if not enabled.");
}); });
Window::OnWndMessage(WM_INPUT, RawMouse::OnRawInput); Window::OnWndMessage(WM_INPUT, RawMouse::OnRawInput);

View File

@ -157,7 +157,7 @@ namespace Components
void Window::EnableDpiAwareness() void Window::EnableDpiAwareness()
{ {
const Utils::Library user32{ "user32.dll" }; const Utils::Library user32{"user32.dll"};
user32.invokePascal<void>("SetProcessDpiAwarenessContext", DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); user32.invokePascal<void>("SetProcessDpiAwarenessContext", DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
} }

View File

@ -7486,6 +7486,8 @@ namespace Game
unsigned int sysMsgTime; unsigned int sysMsgTime;
}; };
static_assert(sizeof(WinVars_t) == 0x24);
struct WinMouseVars_t struct WinMouseVars_t
{ {
int oldButtonState; int oldButtonState;
@ -7494,6 +7496,7 @@ namespace Game
bool mouseInitialized; bool mouseInitialized;
}; };
static_assert(sizeof(WinMouseVars_t) == 0x10);
#pragma endregion #pragma endregion