update co-routine library.

master
Zaafar 5 years ago
parent c84bda8a62
commit 1548da1f2f
  1. 3
      ClickableTransparentOverlay/ClickableTransparentOverlay.csproj
  2. 10
      ClickableTransparentOverlay/NativeMethods.cs
  3. 24
      ClickableTransparentOverlay/Overlay.cs
  4. 10
      DriverProgram/Program.cs

@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Version>1.0.1</Version> <Version>1.0.1</Version>
<Authors>Zaafar</Authors> <Authors>Zaafar</Authors>
<Product /> <Product />
@ -29,7 +30,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Coroutine" Version="1.0.4" /> <PackageReference Include="Coroutine" Version="2.0.0" />
<PackageReference Include="ImGui.NET" Version="1.75.0" /> <PackageReference Include="ImGui.NET" Version="1.75.0" />
<PackageReference Include="Veldrid" Version="4.7.0" /> <PackageReference Include="Veldrid" Version="4.7.0" />
<PackageReference Include="Veldrid.ImageSharp" Version="4.7.0" /> <PackageReference Include="Veldrid.ImageSharp" Version="4.7.0" />

@ -17,7 +17,7 @@ namespace ClickableTransparentOverlay
private const int SW_HIDE = 0x00; private const int SW_HIDE = 0x00;
private const int SW_SHOW = 0x05; private const int SW_SHOW = 0x05;
public static bool IsClickable = true; private static bool isClickable = true;
private static IntPtr GWL_EXSTYLE_CLICKABLE = IntPtr.Zero; private static IntPtr GWL_EXSTYLE_CLICKABLE = IntPtr.Zero;
private static IntPtr GWL_EXSTYLE_NOT_CLICKABLE = IntPtr.Zero; private static IntPtr GWL_EXSTYLE_NOT_CLICKABLE = IntPtr.Zero;
@ -47,16 +47,16 @@ namespace ClickableTransparentOverlay
/// <param name="WantClickable">Set to true if you want to make the window clickable otherwise false.</param> /// <param name="WantClickable">Set to true if you want to make the window clickable otherwise false.</param>
internal static void SetOverlayClickable(IntPtr handle, bool WantClickable) internal static void SetOverlayClickable(IntPtr handle, bool WantClickable)
{ {
if (!IsClickable && WantClickable) if (!isClickable && WantClickable)
{ {
SetWindowLongPtr(handle, GWL_EXSTYLE, GWL_EXSTYLE_CLICKABLE); SetWindowLongPtr(handle, GWL_EXSTYLE, GWL_EXSTYLE_CLICKABLE);
SetFocus(handle); SetFocus(handle);
IsClickable = true; isClickable = true;
} }
else if(IsClickable && !WantClickable) else if(isClickable && !WantClickable)
{ {
SetWindowLongPtr(handle, GWL_EXSTYLE, GWL_EXSTYLE_NOT_CLICKABLE); SetWindowLongPtr(handle, GWL_EXSTYLE, GWL_EXSTYLE_NOT_CLICKABLE);
IsClickable = false; isClickable = false;
} }
} }

@ -27,24 +27,6 @@ namespace ClickableTransparentOverlay
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Overlay"/> class. /// Initializes a new instance of the <see cref="Overlay"/> class.
/// </summary> /// </summary>
/// <param name="x">
/// x position of the overlay.
/// </param>
/// <param name="y">
/// y position of the overlay.
/// </param>
/// <param name="width">
/// width of the overlay.
/// </param>
/// <param name="height">
/// height of the Overlay.
/// </param>
/// <param name="fps">
/// fps of the overlay.
/// </param>
/// <param name="debug">
/// In this mode, overlay will not hide the Console.
/// </param>
static Overlay() static Overlay()
{ {
clearColor = new Vector4(0.00f, 0.00f, 0.00f, 0.00f); clearColor = new Vector4(0.00f, 0.00f, 0.00f, 0.00f);
@ -78,6 +60,9 @@ namespace ClickableTransparentOverlay
NativeMethods.SetOverlayClickable(window.Handle, false); NativeMethods.SetOverlayClickable(window.Handle, false);
} }
/// <summary>
/// Infinitely renders the over (and execute co-routines) till it's closed.
/// </summary>
public static void RunInfiniteLoop() public static void RunInfiniteLoop()
{ {
DateTime previous = DateTime.Now; DateTime previous = DateTime.Now;
@ -129,6 +114,9 @@ namespace ClickableTransparentOverlay
/// </summary> /// </summary>
public static bool Visible { get; set; } = true; public static bool Visible { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether to hide the terminal window.
/// </summary>
public static bool TerminalWindow public static bool TerminalWindow
{ {
get => terminal; get => terminal;

@ -29,11 +29,11 @@ namespace DriverProgram
Overlay.RunInfiniteLoop(); Overlay.RunInfiniteLoop();
} }
private static IEnumerator<IWait> SubmitRenderLogic() private static IEnumerator<Wait> SubmitRenderLogic()
{ {
while (true) while (true)
{ {
yield return new WaitEvent(Overlay.OnRender); yield return new Wait(Overlay.OnRender);
if (NativeMethods.IsKeyPressed(0x7B)) //F12. if (NativeMethods.IsKeyPressed(0x7B)) //F12.
{ {
@ -122,7 +122,7 @@ namespace DriverProgram
// Time Based Coroutines are executed even when the Overlay is invisible. // Time Based Coroutines are executed even when the Overlay is invisible.
// So in case there is a reason you want to hide the overlay, u can use timebased // So in case there is a reason you want to hide the overlay, u can use timebased
// coroutines to bring it back. // coroutines to bring it back.
CoroutineHandler.InvokeLater(new WaitSeconds(seconds), () => { Overlay.Visible = true; }); CoroutineHandler.InvokeLater(new Wait(seconds), () => { Overlay.Visible = true; });
} }
ImGui.NewLine(); ImGui.NewLine();
@ -153,11 +153,11 @@ namespace DriverProgram
} }
} }
private static IEnumerator<IWait> UpdateOverlaySample2() private static IEnumerator<Wait> UpdateOverlaySample2()
{ {
while (true) while (true)
{ {
yield return new WaitSeconds(1); yield return new Wait(1);
for (int i = 0; i < circleCenters.Length; i++) for (int i = 0; i < circleCenters.Length; i++)
{ {
circleCenters[i].X = randomGen.Next(0, 2560); circleCenters[i].X = randomGen.Next(0, 2560);

Loading…
Cancel
Save