adding full screen drawing example

master
Zaafar Ahmed 5 years ago
parent 2ea4e5115c
commit 5f2474b1eb
  1. 39
      DriverProgram/Program.cs

@ -2,6 +2,7 @@
{ {
using ClickableTransparentOverlay; using ClickableTransparentOverlay;
using ImGuiNET; using ImGuiNET;
using System;
using System.IO; using System.IO;
using System.Numerics; using System.Numerics;
using System.Threading; using System.Threading;
@ -10,17 +11,29 @@
{ {
private static bool isRunning = true; private static bool isRunning = true;
private static bool showImGuiDemo = false; private static bool showImGuiDemo = false;
private static bool drawOnScreen = false;
private static Random randomGen = new Random();
private static int totalCircles = 10;
private static Vector2[] circleCenters = new Vector2[totalCircles];
private static int Fps = 144; private static int Fps = 144;
private static int[] resizeHelper = new int[4] { 0, 0, 2560, 1440 }; private static int[] resizeHelper = new int[4] { 0, 0, 2560, 1440 };
private static int seconds = 5; private static int seconds = 5;
private static Overlay overlay = new Overlay(0, 0, 2560, 1440, Fps, false); private static Overlay overlay = new Overlay(0, 0, 2560, 1440, Fps, true);
private static void MainApplicationLogic() private static void MainApplicationLogic()
{ {
while (isRunning) while (isRunning)
{ {
Thread.Sleep(10); for (int i = 0; i < circleCenters.Length; i++)
{
circleCenters[i].X = randomGen.Next(0, 2560);
circleCenters[i].Y = randomGen.Next(0, 1440);
}
Thread.Sleep(600);
} }
overlay.Dispose(); overlay.Dispose();
} }
@ -66,6 +79,12 @@
showImGuiDemo = true; showImGuiDemo = true;
} }
ImGui.NewLine();
if(ImGui.Button("Draw on Screen"))
{
drawOnScreen = true;
}
ImGui.NewLine(); ImGui.NewLine();
if (File.Exists("image.png")) if (File.Exists("image.png"))
{ {
@ -83,6 +102,22 @@
{ {
ImGui.ShowDemoWindow(ref showImGuiDemo); ImGui.ShowDemoWindow(ref showImGuiDemo);
} }
if(drawOnScreen)
{
ImGui.SetNextWindowContentSize(ImGui.GetIO().DisplaySize);
ImGui.SetNextWindowPos(new Vector2(0, 0));
ImGui.Begin("Background Screen", ref drawOnScreen, ImGuiWindowFlags.NoInputs |
ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.NoBringToFrontOnFocus |
ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoScrollbar |
ImGuiWindowFlags.NoSavedSettings | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoTitleBar);
var windowPtr = ImGui.GetWindowDrawList();
for (int i = 0; i < circleCenters.Length; i++)
{
windowPtr.AddCircleFilled(circleCenters[i], 10.0f, (uint)(((255 << 24) | (00 << 16) | (00 << 8) | 255) & 0xffffffffL));
}
ImGui.End();
}
} }
} }
} }
Loading…
Cancel
Save