internal void OnDraw() { RenderLoop.Run(this, () => { if (!ExSharpBase.Events.Drawing.IsMenuBeingDrawn) { NativeImport.BringWindowToTop(this.Handle); NativeImport.RECT rct = default; NativeImport.GetWindowRect(Utils.GetPubgWindow(), out rct); if (this.Location != new System.Drawing.Point(rct.Left, rct.Top)) { this.Width = rct.Right - rct.Left; this.Height = rct.Bottom - rct.Top; this.Location = new System.Drawing.Point(rct.Left, rct.Top); } } DrawFactory.device.Clear(ClearFlags.Target, new SharpDX.Mathematics.Interop.RawColorBGRA(0, 0, 0, 0), 1.0f, 0); DrawFactory.device.SetRenderState(RenderState.ZEnable, false); DrawFactory.device.SetRenderState(RenderState.Lighting, false); DrawFactory.device.SetRenderState(RenderState.CullMode, Cull.None); DrawFactory.device.SetTransform(TransformState.Projection, Matrix.OrthoOffCenterLH(0, this.Width, this.Height, 0, 0, 1)); DrawFactory.device.BeginScene(); ExSharpBase.Events.Drawing.OnDeviceDraw(); DrawFactory.device.EndScene(); DrawFactory.device.Present(); }); }
internal void OnDraw() { DateTime lastRender = DateTime.UtcNow; RenderLoop.Run(this, () => { int elapsedSinceRender = (int)(DateTime.UtcNow - lastRender).TotalMilliseconds; System.Threading.Thread.Sleep(Math.Max(0, 1000 / 80 - elapsedSinceRender)); lastRender = DateTime.UtcNow; if (!ExSharpBase.Events.Drawing.IsMenuBeingDrawn) { NativeImport.BringWindowToTop(this.Handle); } DrawFactory.device.Clear(ClearFlags.Target, new SharpDX.Mathematics.Interop.RawColorBGRA(0, 0, 0, 0), 1.0f, 0); DrawFactory.device.SetRenderState(RenderState.ZEnable, false); DrawFactory.device.SetRenderState(RenderState.Lighting, false); DrawFactory.device.SetRenderState(RenderState.CullMode, Cull.None); DrawFactory.device.SetTransform(TransformState.Projection, Matrix.OrthoOffCenterLH(0, this.Width, this.Height, 0, 0, 1)); DrawFactory.device.BeginScene(); ExSharpBase.Events.Drawing.OnDeviceDraw(); DrawFactory.device.EndScene(); DrawFactory.device.Present(); }); }
internal void OnDraw() { RenderLoop.Run(this, () => { if (!ExSharpBase.Events.Drawing.IsMenuBeingDrawn) { NativeImport.BringWindowToTop(Handle); } DrawFactory.device.Clear(ClearFlags.Target, new RawColorBGRA(0, 0, 0, 0), 1.0f, 0); DrawFactory.device.SetRenderState(RenderState.ZEnable, false); DrawFactory.device.SetRenderState(RenderState.Lighting, false); DrawFactory.device.SetRenderState(RenderState.CullMode, Cull.None); DrawFactory.device.SetTransform(TransformState.Projection, Matrix.OrthoOffCenterLH(0, Width, Height, 0, 0, 1)); DrawFactory.device.BeginScene(); ExSharpBase.Events.Drawing.OnDeviceDraw(); DrawFactory.device.EndScene(); DrawFactory.device.Present(); }); }