Work on handling inputs

We still need to intercept SharpDX inputs
This commit is contained in:
2024-11-09 03:41:25 -05:00
parent 303b765940
commit ed8d307843
2 changed files with 24 additions and 35 deletions

View File

@@ -21,32 +21,4 @@ public class RenderHookPatch
{
ImGuiHandler.Instance?.HookWindow((HWND)__instance.Handle);
}
[HarmonyPatch]
public static class RenderMessagePatches
{
[HarmonyTargetMethods]
private static IEnumerable<MethodInfo> TargetMethods()
{
yield return AccessTools.Method(typeof(MyGameForm), nameof(MyGameWindow.WndProc));
yield return AccessTools.Method(typeof(RenderForm), "WndProc");
}
[HarmonyPrefix]
private static bool WndProcPrefix(MyGameForm __instance, ref Message m)
{
if (ImGuiHandler.Instance is not { } handler)
return true;
if (m.Msg is >= 256 and <= 265)
return !handler.Io.WantTextInput;
if (__instance.ShowCursor && m.Msg is >= 512 and <= 526)
return !handler.Io.WantCaptureMouse;
return true;
}
}
}