private void _frameTimer_OnFrameStarting(FrameTimer timer, D2DDevice device) { if (!_initializeGraphicObjects) { return; } if (!device.IsInitialized) { return; } if (device.IsDrawing) { return; } // colors automatically normalize values to fit. you can use 1.0f but also 255.0f. _blackBrush = device.CreateSolidColorBrush(0x0, 0x0, 0x0, 0xFF); _redBrush = device.CreateSolidColorBrush(0xFF, 0x0, 0x0, 0xFF); _greenBrush = device.CreateSolidColorBrush(0x0, 0xFF, 0x0, 0xFF); _blueBrush = device.CreateSolidColorBrush(0x0, 0x0, 0xFF, 0xFF); _yellowBrush = device.CreateSolidColorBrush(0xFF, 0xFF, 0x0, 0xFF); _gradient = new D2DLinearGradientBrush(device, new D2DColor(0, 0, 80), new D2DColor(0x88, 0, 125), new D2DColor(0, 0, 225)); _initializeGraphicObjects = false; }
protected ButtonCircleImage(Asset image, Asset imageInverted, D2DSolidColorBrush mouseOverColor) { _image = image; _imageInverted = imageInverted; _mouseOverColor = mouseOverColor; Size = new(48f, 48f); }
static void Main(string[] args) { _window = new OverlayWindow(new OverlayOptions() { BypassTopmost = false, Height = 600, Width = 800, WindowTitle = "GameOverlayExample", X = 0, Y = 0 }); _device = new D2DDevice(new DeviceOptions() { AntiAliasing = true, Hwnd = _window.WindowHandle, MeasureFps = true, MultiThreaded = false, VSync = false }); _image = _device.LoadImage(@"C:\Users\Michel\Desktop\NotificationBackOrange.png"); _backgroundBrush = _device.CreateSolidColorBrush(0xF1, 0x9A, 0x4C, 255); _foregroundBrush = _device.CreateSolidColorBrush(0, 0, 0, 255); _font = _device.CreateFont(new FontOptions() { Bold = false, FontFamilyName = "Arial", FontSize = 14, Italic = false, WordWrapping = false }); _notification = new OverlayNotification(_device, _backgroundBrush, _foregroundBrush, _font) { Body = "You earned an achievement!", BodySize = 14, Header = "Achievement", HeaderSize = 18 }; _frameTimer = new FrameTimer(_device, 0); _window.OnWindowBoundsChanged += _window_OnWindowBoundsChanged; _frameTimer.OnFrame += _frameTimer_OnFrame; _frameTimer.Start(); Console.WriteLine("Press enter to exit"); Console.ReadLine(); }
private static void Main(string[] args) { Console.WindowHeight = Console.LargestWindowHeight / 2; Console.WindowWidth = Console.LargestWindowWidth / 2; OverlayCreationOptions overlayOptions = new OverlayCreationOptions() { BypassTopmost = true, Height = 600, Width = 600, WindowTitle = HelperMethods.GenerateRandomString(5, 11), X = Console.WindowLeft, Y = Console.WindowTop }; StickyOverlayWindow overlay = new StickyOverlayWindow(Process.GetCurrentProcess().MainWindowHandle, overlayOptions); DeviceOptions rendererOptions = new DeviceOptions() { AntiAliasing = true, Hwnd = overlay.WindowHandle, MeasureFps = true, VSync = false }; gfx = new D2DDevice(rendererOptions); font = gfx.CreateFont("Arial", 22); red = gfx.CreateSolidColorBrush(255, 0, 0, 255); black = gfx.CreateSolidColorBrush(0, 0, 0, 255); green = gfx.CreateSolidColorBrush(0, 255.0f, 0, 255.0f); backgroundBrush = gfx.CreateSolidColorBrush(0xCC, 0xCC, 0xCC, 80); skeleton = CreateSkeleton(gfx); radar = CreateRadarBackground(gfx, new Rectangle(100, 100, 400, 400), 10.0f); overlay.OnWindowBoundsChanged += Overlay_OnWindowBoundsChanged; FrameTimer timer = new FrameTimer(0, gfx); timer.FrameStarting += Timer_OnFrameStart; timer.Start(); Console.ReadLine(); timer.Stop(); gfx.Dispose(); overlay.Dispose(); }
public static void Main(string[] args) { IntPtr handle = /*new IntPtr(0x30F98);//*/ Process.GetCurrentProcess().MainWindowHandle; StickyOverlayWindow window = new StickyOverlayWindow(handle); window.OnWindowBoundsChanged += Window_OnWindowBoundsChanged; device = new D2DDevice(window.WindowHandle, false, true, true); D2DSolidColorBrush red = device.CreateSolidColorBrush(255, 0, 0); D2DSolidColorBrush green = device.CreateSolidColorBrush(0, 255, 0); D2DSolidColorBrush blue = device.CreateSolidColorBrush(0, 0, 255); D2DSolidColorBrush black = device.CreateSolidColorBrush(0, 0, 0); while (true) { //RECT windowRect = new RECT(); //RECT clientRect = new RECT(); RECT fixedRect = new RECT(); //User32.GetWindowRect(handle, out windowRect); //User32.GetClientRect(handle, out clientRect); HelperMethods.GetWindowClientRect(handle, out fixedRect); //Console.WriteLine("WindowRect: " + windowRect.Output()); //Console.WriteLine("ClientRect: " + clientRect.Output()); //Console.WriteLine("FixedRect: " + fixedRect.Output()); //Console.WriteLine(); //Console.WriteLine("WindowRect: " + windowRect.ToBounds()); //Console.WriteLine("ClientRect: " + clientRect.ToBounds()); //Console.WriteLine("FixedRect: " + fixedRect.ToBounds()); using (var scene = device.UseScene()) { //device.FillRectangle(0, 0, fixedRect.Right - fixedRect.Left, fixedRect.Bottom - fixedRect.Top, red); //device.DrawRectangle(0, 0, windowRect.Right - windowRect.Left, windowRect.Bottom - windowRect.Top, 16.0f, red); //device.DrawRectangle(0, 0, clientRect.Right - clientRect.Left, clientRect.Bottom - clientRect.Top, 12.0f, green); //device.DrawRectangle(0, 0, fixedRect.Right - fixedRect.Left, fixedRect.Bottom - fixedRect.Top, 6.0f, blue); } Console.ReadLine(); } }
private void _frameTimer_OnFrame(FrameTimer timer, D2DDevice device) { // the render loop will call device.BeginScene() and device.EndScene() for us if (!device.IsDrawing) { _initializeGraphicObjects = true; return; } device.ClearScene(); if (Config.focused) { if (vars.drawFOV == 1) { device.DrawCircle(vars.ScreenWidth / 2 + 1, vars.ScreenHeight / 2 + 1, Config.FOV, 1, _blueBrush); //Draw FOV circle } //Crosshair aimPunch Point centralPoint = new Point(vars.recoilX + 1, vars.recoilY + 1); device.DrawCrosshair(CrosshairStyle.Plus, centralPoint, 7, 1f, _greenBrush); for (int i = 0; i < Config.numberOfPlayers; i++) { if (Lists.team[i] == 2) { _emptyBrush = _redBrush; } else { _emptyBrush = _greenBrush; }; if (Lists.dormant[i] == 1) { _emptyBrush = _yellowBrush; } if (Lists.health[i] > 0 && vars.localClass.LocalPlayer != Lists.entityID[i] && Lists.entityID[i] != Lists.observer[i] && Lists.selectedBoneX[i] != 0) { device.OutlineCircle(Lists.selectedBoneX[i], Lists.selectedBoneY[i], Lists.distance[i] + 0.1f, 2.0f, _emptyBrush, _blackBrush); } } } }
private void _frameTimer_OnFrameStarting(FrameTimer timer, D2DDevice device) { if (!_initializeGraphicObjects) { return; } if (!device.IsInitialized) { return; } if (device.IsDrawing) { return; } _backgroundColor = new D2DColor(0x24, 0x29, 0x2E, 0xFF); _font = _device.CreateFont(new FontOptions() { Bold = false, FontFamilyName = "Arial", FontSize = 16, Italic = false, WordWrapping = true }); // colors automatically normalize values to fit. you can use 1.0f but also 255.0f. _blackBrush = device.CreateSolidColorBrush(0x0, 0x0, 0x0, 0xFF); _redBrush = device.CreateSolidColorBrush(0xFF, 0x0, 0x0, 0xFF); _greenBrush = device.CreateSolidColorBrush(0x0, 0xFF, 0x0, 0xFF); _blueBrush = device.CreateSolidColorBrush(0x0, 0x0, 0xFF, 0xFF); _gradient = new D2DLinearGradientBrush(device, new D2DColor(0, 0, 80), new D2DColor(0x88, 0, 125), new D2DColor(0, 0, 225)); // loads an image from resource bytes (.png in this case) _image = device.LoadImage(Properties.Resources.placeholder_image_bytes); _initializeGraphicObjects = false; }
private void _frameTimer_OnFrameStarting(FrameTimer timer, D2DDevice device) { if (!_initializeGraphicObjects) { return; } if (!device.IsInitialized) { return; } if (device.IsDrawing) { return; } _backgroundColor = new D2DColor(0, 0, 0, 0); _font = _device.CreateFont(new FontOptions() { Bold = false, FontFamilyName = "Times New Roman", FontSize = 10, Italic = false, WordWrapping = true }); // colors automatically normalize values to fit. you can use 1.0f but also 255.0f. _blackBrush = device.CreateSolidColorBrush(0x0, 0x0, 0x0, 0xFF); _redBrush = device.CreateSolidColorBrush(0xFF, 0x0, 0x0, 0xFF); _greenBrush = device.CreateSolidColorBrush(0x0, 0xFF, 0x0, 0xFF); _blueBrush = device.CreateSolidColorBrush(0x0, 0x0, 0xFF, 0xFF); _initializeGraphicObjects = false; }
public static void FillEllipse(D2D_RECT_F drect, D2DSolidColorBrush brush) => Direct2D_FillEllipse(drect, brush);
public static void DrawEllipse(D2D_RECT_F drect, float strokeWidth, D2DSolidColorBrush brush) => Direct2D_DrawEllipse(drect, strokeWidth, brush);
public static extern void Direct2D_DrawEllipse(D2D_RECT_F drect, float strokeWidth, D2DSolidColorBrush brush);
public static void Draw(TextLayout textLayout, D2D_POINT_2F location, D2DSolidColorBrush brush) => textLayout.Draw(location, brush);
protected ButtonTouchControl(Asset image, D2DSolidColorBrush mouseOverColor) { _image = image; _mouseOverColor = mouseOverColor; Size = new(48f, 48f); }
public static extern void Direct2D_DrawTextLayout(IntPtr pTextLayout, D2D_POINT_2F location, D2DSolidColorBrush brush);
public static extern void Direct2D_DrawTextFormat(IntPtr pTextFormat, string text, D2D_RECT_F drect, D2DSolidColorBrush brush);
public static extern void Direct2D_FillEllipse(D2D_RECT_F drect, D2DSolidColorBrush brush);
internal void Draw(string text, D2D_RECT_F drect, D2DSolidColorBrush brush) => Direct2D_DrawTextFormat(TextFormatPtr, text, drect, brush);
public static void Draw(TextFormat textFormat, string text, D2D_RECT_F drect, D2DSolidColorBrush brush) => textFormat.Draw(text, drect, brush);
public static void DrawLine(D2D_POINT_2F dp0, D2D_POINT_2F dp1, float strokeWidth, D2DSolidColorBrush brush) => Direct2D_DrawLine(dp0, dp1, strokeWidth, brush);
public static extern void Direct2D_DrawLine(D2D_POINT_2F dp0, D2D_POINT_2F dp1, float strokeWidth, D2DSolidColorBrush brush);