Ejemplo n.º 1
0
        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();
            });
        }
Ejemplo n.º 2
0
        internal void OnLoad()
        {
            NativeImport.SetWindowLong(this.Handle, DrawFactory.GWL_EXSTYLE, (IntPtr)(NativeImport.GetWindowLong(this.Handle, DrawFactory.GWL_EXSTYLE) ^ (DrawFactory.WS_EX_LAYERED ^ DrawFactory.WS_EX_TRANSPARENT)));/*(IntPtr)(NativeImport.GetWindowLong(this.Handle, DrawFactory.GWL_EXSTYLE) ^*/
            NativeImport.SetLayeredWindowAttributes(this.Handle, 0, 255, DrawFactory.LWA_ALPHA);
            NativeImport.RECT rct = default;
            NativeImport.GetWindowRect(Utils.GetPubgWindow(), out rct);

            this.Width    = rct.Right - rct.Left;
            this.Height   = rct.Bottom - rct.Top;
            this.Location = new System.Drawing.Point(rct.Left, rct.Top);

            if (IsInitialised == false)
            {
                PresentParameters presentParameters = new PresentParameters();
                presentParameters.Windowed         = true;
                presentParameters.SwapEffect       = SwapEffect.Discard;
                presentParameters.BackBufferFormat = Format.A8R8G8B8;

                DrawFactory.device = new Device(DrawFactory.D3D, 0, DeviceType.Hardware, this.Handle, CreateFlags.HardwareVertexProcessing, presentParameters);

                DrawFactory.drawLine          = new Line(DrawFactory.device);
                DrawFactory.drawBoxLine       = new Line(DrawFactory.device);
                DrawFactory.drawCircleLine    = new Line(DrawFactory.device);
                DrawFactory.drawFilledBoxLine = new Line(DrawFactory.device);
                DrawFactory.drawTriLine       = new Line(DrawFactory.device);

                FontDescription fontDescription = new FontDescription()
                {
                    FaceName        = "Fixedsys Regular",
                    CharacterSet    = FontCharacterSet.Default,
                    Height          = 20,
                    Weight          = FontWeight.Regular,
                    MipLevels       = 0,
                    OutputPrecision = FontPrecision.Default,
                    PitchAndFamily  = FontPitchAndFamily.Default,
                    Quality         = FontQuality.ClearType
                };

                DrawFactory.font = new SharpDX.Direct3D9.Font(DrawFactory.device, fontDescription);
                DrawFactory.InitialiseCircleDrawing(DrawFactory.device);

                IsInitialised = true;

                OnDraw();
            }
        }