示例#1
0
        public CHBuild genOffset()
        {
            CHBuild ret = new CHBuild();

            ret.rects  = new SharpDX.Rectangle[rects.Length][];
            ret.colors = (SharpDX.ColorBGRA[])colors.Clone();
            ret.size   = size;
            for (int i = 0; i < rects.Length; i++)
            {
                ret.rects[i] = new SharpDX.Rectangle[rects[i].Length];
                for (int j = 0; j < ret.rects[i].Length; j++)
                {
                    SharpDX.Rectangle cpy = rects[i][j];
                    ret.rects[i][j] = new SharpDX.Rectangle(
                        D3DHook.connection.X / 2 - ret.size / 2 + cpy.X,
                        D3DHook.connection.Y / 2 - ret.size / 2 + cpy.Y,
                        cpy.Width,
                        cpy.Height);
                }
            }
            return(ret);
        }
示例#2
0
        int EndSceneHook(IntPtr devicePtr)
        {
            Device device = (Device)devicePtr;

            if (!closed && true)
            {
                //don't initialize font, it MAY crash
                //if (dxFont == null)
                //	dxFont = new Font(device, fdesc);

                int chTypei = 0;
                chTypei = (int)connection.chType;

                if (prebakedCH[chTypei] == null || connection.refreshData)
                {
                    switch (connection.chType)
                    {
                    case CHType.none: prebakedCH[chTypei] = CHBuild.DefaultNone; break;

                    case CHType.lines: prebakedCH[chTypei] = CHBuild.DefaultLines.genOffset(); break;

                    case CHType.thinlines: prebakedCH[chTypei] = CHBuild.DefaultThinLines.genOffset(); break;

                    case CHType.square: prebakedCH[chTypei] = CHBuild.DefaultSquare.genOffset(); break;

                    case CHType.custom:
                        int[] ibuff = connection.customCHBD as int[];
                        if (ibuff != null)
                        {
                            prebakedCH[chTypei] = new CHBuild(ibuff).genOffset();
                        }
                        break;
                    }
                    prebakedCH[(int)CHType.DOT] = CHBuild.DefaultDot.genOffset();
                }

                if (connection.drawDot)
                {
                    device.Clear(ClearFlags.Target, prebakedCH[(int)CHType.DOT].colors[0], 0, 0, prebakedCH[(int)CHType.DOT].rects[0]);
                }

                CHBuild selected = prebakedCH[chTypei];
                if (selected != null)
                {
                    for (int i = 0; i < selected.colors.Length; i++)
                    {
                        device.Clear(ClearFlags.Target, selected.colors[i], 0, 0, selected.rects[i]);
                    }
                    //dxFont.DrawText(null, "bluub", con.X / 2 - 3, con.Y / 2 - 19, SharpDX.Color.White);
                }


                //http://www.unknowncheats.me/forum/d3d-tutorials-and-source/58821-simple-2d-circle-using-drawprimitiveup.html
                //device.DrawUserPrimitives(PrimitiveType.LineStrip)
            }


            connection.getFPS = fpsTool.getFPS();
            fpsTool.limitFPS();

            device.EndScene();
            return(SharpDX.Result.Ok.Code);
        }