コード例 #1
0
        public void SDXThread(object sender)
        {
            float progress = 0.0f;

            while (IsRunning)
            {
                GameHandle = GameProcess.MainWindowHandle;

                if (GameProcess.HasExited)
                {
                    IsRunning = false;
                }

                // get the coords of the csgo window
                GetWindowRect(GameHandle, out WindowBounds);

                // set the location of the form overlay
                try
                {
                    if (WindowBounds.X != Location.X || WindowBounds.Width != Size.Width)
                    {
                        Location = new System.Drawing.Point(WindowBounds.X, WindowBounds.Y);
                        Size     = new System.Drawing.Size(WindowBounds.Width, WindowBounds.Height);
                    }
                }
                catch { }

                // set the size of the form overlay
                WindowSize = new Size2(WindowBounds.Width, WindowBounds.Height);

                RenderDevice.BeginDraw();
                RenderDevice.Clear(Color.Transparent);
                RenderDevice.TextAntialiasMode = TextAntialiasMode.Aliased; // you can set another text mode

                //place your rendering things here
                if (GetActiveWindowTitle() == "Counter-Strike: Global Offensive" || GetActiveWindowTitle() == "Dolphin")
                {
                    Mem.StartProcess();

                    // Create Local Entity
                    LocalEntity LE = new LocalEntity();

                    // update viewmatrix
                    ViewMatrix = Matrix4x4.ReadMatrix(Mem, dwClient + dwViewMatrix);

                    // Update radar image (in case of map change)
                    if (RadarEnabled)
                    {
                        RadarImageUpdate();
                    }

                    // perform this loop for every entity in the game
                    for (int i = 0; i < 32; i++)
                    {
                        // increment rainbow cycle colour
                        progress += 0.00001f;

                        // create new entity instance
                        Entity Entity = new Entity(i);

                        // Call Radar if enabled on GUI
                        if (RadarEnabled)
                        {
                            RadarLoop(Entity, LE);
                        }

                        // Call ESP if enabled on GUI
                        if (BoxESPEnabledFriendly || BoxESPEnabledOpposition || SkeletonsEnabledFriendly || SkeletonsEnabledOpposition)
                        {
                            ESPLoop(Entity, LE, progress);
                        }

                        // Draw HP Label if enabled on GUI
                        if (IsEnabled_EnemyHPLabel && Entity.Entity_Team != LE.LocalEntity_Team && Entity.Entity_isAlive())
                        {
                            Drawing2D.DrawShadowText(Entity.Entity_Position_W2S.X - 20, Entity.Entity_Position_W2S.Y, 12.0f, Color.Lime, ("《 ❤ " + Entity.Entity_Health + " 》"));
                        }

                        // Draw Glow if enabled on GUI
                        if (GlowEnabledOpposition || GlowEnabledFriendly)
                        {
                            DoGlow(Mem, Entity, LE, progress);
                        }

                        // Call trigger if enabled on GUI
                        if (IsEnabled_TriggerBot)
                        {
                            TriggerbotLoop(LE);
                        }
                    }
                    Thread.Sleep(1);
                }
                RenderDevice.EndDraw();
            }
        }
コード例 #2
0
        static void Main()
        {
            int width = 300, height = 300;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Form1        gameForm = new Form1();
            RenderDevice device   = new RenderDevice(gameForm, width, height);

            gameForm.Show();

            Viewport vp;

            vp.X      = 0;
            vp.Y      = 0;
            vp.Near   = 0.0f;
            vp.Far    = 1.0f;
            vp.Width  = width;
            vp.Height = height;

            device.Viewport = vp;

            device.ShadeMode        = ShadeMode.Smooth;
            device.DepthTestEnabled = true;
            device.DepthFunction    = DepthFunction.LessEqual;
            device.ClearColor       = Color.Black;
            device.DepthClearValue  = 1.0f;

            ReadMesh();

            while (gameForm.Created)
            {
                device.Clear(ClearFlags.Color | ClearFlags.Depth);

                // setup transforms

                device.ModelMatrix = Matrix.Scale(3, 3, 3) * Matrix.RotateY(Environment.TickCount / 180.0f);
                device.ViewMatrix  = Matrix.LookAt(new Vector3(0, 3, 5),
                                                   new Vector3(0, 0, 0),
                                                   new Vector3(0, 1, 0));
                device.ProjectionMatrix = Matrix.PerspectiveFOV((float)Math.PI / 4, width / height, 1.0f, 100.0f);

                // setup material
                Material mtrl = new Material();
                mtrl.Diffuse    = mtrl.Ambient = Color.White;
                device.Material = mtrl;

                // setup light
                Vector3 vecDir;
                Light   light = new Light();
                light.Type    = LightType.Directional;
                light.Diffuse = Color.White;
                vecDir        = new Vector3(0, 0, -1);
                vecDir.Normalize();
                light.Direction       = vecDir;
                light.Range           = 1000.0f;
                light.Enabled         = true;
                device.Light[0]       = light;
                device.LightEnabled   = true;
                device.AmbientLight   = Color.FromArgb(0x00202020);
                device.MaterialSource = MaterialSource.Material;

                device.BeginScene();
                device.DrawPrimitive(vertices, PrimitiveType.TriangleList, 0, polyNum);
                device.EndScene();

                device.Present();

                Application.DoEvents();
            }
        }