public static Map.Map ChallengeCleric(SlimDX.Direct3D9.Device device)
        {
            var m = Medium(device);

            for (int y = 0; y < 5; y++)
            {
                for (int x = 0; x < 5; x++)
                {
                    m.DynamicsRoot.AddChild(new Map.Units.Grunt
                    {
                        Translation = new SlimDX.Vector3(22 + x * 3, 22 + y * 3, 0),
                        State       = Map.UnitState.Dead
                    });
                }
            }
            m.DynamicsRoot.AddChild(new Map.Units.Cleric {
                Translation = new SlimDX.Vector3(31, 31, 0)
            });
            m.DynamicsRoot.AddChild(new Map.Units.Cleric {
                Translation = new SlimDX.Vector3(26, 31, 0)
            });
            m.DynamicsRoot.AddChild(new Map.Units.Cleric {
                Translation = new SlimDX.Vector3(31, 26, 0)
            });
            return(m);
        }
        public static Map.Map RegionSpawnPointTest(SlimDX.Direct3D9.Device device)
        {
            var m = Medium(device);
            var r = new Common.Bounding.Region();

            r.Nodes    = new Common.Bounding.RegionNode[1];
            r.Nodes[0] = new Common.Bounding.RegionNode(new Vector3[]
            {
                new Vector3(30, 30, 0), new Vector3(30, 40, 0),
                new Vector3(40, 40, 0), new Vector3(40, 30, 0),
            });
            m.Regions.Add(new Map.Region {
                Name = "test", BoundingRegion = r
            });
            throw new NotImplementedException();

            /*m.DynamicsRoot.AddChild(new Map.SpawningPoint
             * {
             *  SpawnCount = 10,
             *  Region = "test",
             *  SpawnType = "Grunt",
             *  Period = 1,
             *  Position = new Vector3(35, 35, 0)
             * });*/
            return(m);
        }
 public ContentPool(SlimDX.Direct3D9.Device device)
 {
     this.Device9 = device;
     LogInit();
     InitStatistics();
     LoadMappersFromAssembly(typeof(Content.ContentPool).Assembly);
 }
        public static Map.Map ChallengeZombieInvasion(SlimDX.Direct3D9.Device device)
        {
            var m = Medium(device);

            m.MainCharacter.Position   = new Vector3(m.Settings.Size.Width / 2f, m.Settings.Size.Width / 2f, 0);
            m.MainCharacter.PistolAmmo = 99999;
            List <Map.Point> spawningPoints = new List <Client.Game.Map.Point>();

            spawningPoints.Add(new Map.Point {
                Name = "Point1", Position = m.MainCharacter.Position + new Vector3(-10, 0, 0)
            });
            spawningPoints.Add(new Map.Point {
                Name = "Point2", Position = m.MainCharacter.Position + new Vector3(10, 0, 0)
            });
            spawningPoints.Add(new Map.Point {
                Name = "Point3", Position = m.MainCharacter.Position + new Vector3(0, -10, 0)
            });
            spawningPoints.Add(new Map.Point {
                Name = "Point4", Position = m.MainCharacter.Position + new Vector3(0, 10, 0)
            });
            foreach (var v in spawningPoints)
            {
                m.DynamicsRoot.AddChild(v);
            }

            m.Scripts.Add(new Client.Game.Map.SpawnScript
            {
                InitDelay  = 0,
                TickPeriod = 4,
                SpawnCount = int.MaxValue,
                SpawnType  = "Grunt",
                Point      = "Point1"
            });
            m.Scripts.Add(new Client.Game.Map.SpawnScript
            {
                InitDelay  = 1,
                TickPeriod = 4,
                SpawnCount = int.MaxValue,
                SpawnType  = "Grunt",
                Point      = "Point2"
            });
            m.Scripts.Add(new Client.Game.Map.SpawnScript
            {
                InitDelay  = 2,
                TickPeriod = 4,
                SpawnCount = int.MaxValue,
                SpawnType  = "Grunt",
                Point      = "Point3"
            });
            m.Scripts.Add(new Client.Game.Map.SpawnScript
            {
                InitDelay  = 3,
                TickPeriod = 4,
                SpawnCount = int.MaxValue,
                SpawnType  = "Grunt",
                Point      = "Point4"
            });

            return(m);
        }
Beispiel #5
0
        void UpdateLogic(SlimDX.Direct3D9.Device device, TimeSpan deltaTime)
        {
            bool shift = Video.Input.InputManager.Input[System.Windows.Forms.Keys.ShiftKey];
            bool ctrl  = Video.Input.InputManager.Input[System.Windows.Forms.Keys.ControlKey];

            if ((shift || ctrl) && Video.Input.InputManager.Input.Mouse.State.IsPressed(0))
            {
                if (Game.GameManager.SelectionManager.IsModelMovement)
                {
                    return;
                }

                var mpos = Game.GameManager.GraphicsThread.GraphicsManager.MousePosition;
                if (mpos.X > 900000)
                {
                    return;
                }

                bool lower = ctrl;
                if (Game.GameManager.ActiveChangeType == ActiveChangeType.Height)
                {
                    ChangeTerrain(mpos, lower);
                }
                else
                {
                    TextureTerrain(mpos, lower);
                }
            }
        }
        void LoadSplatMap2(Map map, SlimDX.Direct3D9.Device device, ZipFile mapFile)
        {
#pragma warning disable 612,618
            if (!string.IsNullOrEmpty(map.Settings.StaticDataSourceMap))
            {
                mapFile = new ZipFile(Path.Combine(Path.GetDirectoryName(map.MapFileName), map.Settings.StaticDataSourceMap));
            }
#pragma warning restore 612,618

            if (!mapFile.ContainsEntry(GetSplatTexture2FileName()))
            {
                map.NewSplatMap2(device);
                if (!string.IsNullOrEmpty(map.Settings.StaticDataSourceMap))
                {
                    mapFile.Dispose();
                }
                return;
            }

            using (var splat2Stream = mapFile[GetSplatTexture2FileName()].OpenReader())
                map.Ground.SplatMap2 =
                    new Graphics.Content.UnmanagedResource <SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D>
                {
                    Resource9 = SlimDX.Direct3D9.Texture.FromStream(device, splat2Stream)
                };
            if (!string.IsNullOrEmpty(map.Settings.StaticDataSourceMap))
            {
                mapFile.Dispose();
            }
        }
        public static Map.Map MediumSparseRandomWithUnits(SlimDX.Direct3D9.Device device)
        {
            var    m = MediumSparseRandom(device);
            Random r = new Random();

            int nUnits = 100;

            // Units
            List <Type> propTypes = new List <Type>();

            foreach (var v in typeof(Map.Unit).Assembly.GetTypes())
            {
                if (typeof(Map.Unit).IsAssignableFrom(v))
                {
                    propTypes.Add(v);
                }
            }
            propTypes.Remove(typeof(Map.Unit));
            propTypes.Remove(typeof(Map.Units.MainCharacter));
            for (int i = 0; i < nUnits; i++)
            {
                var p = (Map.Unit)Activator.CreateInstance(propTypes[r.Next(propTypes.Count)]);
                p.Position = new SlimDX.Vector3(
                    (float)(r.NextDouble() * m.Settings.Size.Width),
                    (float)(r.NextDouble() * m.Settings.Size.Height), 0);
                p.Position = m.Ground.GetHeight(p.Position);
                m.DynamicsRoot.AddChild(p);
            }
            return(m);
        }
        public static Map.Map SomeBrutesAndCommanders(SlimDX.Direct3D9.Device device)
        {
            var m = Medium(device);

            for (int y = 0; y < 2; y++)
            {
                for (int x = 0; x < 2; x++)
                {
                    m.DynamicsRoot.AddChild(new Map.Units.Commander
                    {
                        Position = new SlimDX.Vector3(30 + x, 30 + y, 0),
                    });
                }
            }
            for (int y = 3; y < 5; y++)
            {
                for (int x = 3; x < 5; x++)
                {
                    m.DynamicsRoot.AddChild(new Map.Units.Brute
                    {
                        Position = new SlimDX.Vector3(30 + x, 30 + y, 0),
                    });
                }
            }
            return(m);
        }
        public static Map.Map PackOfEndlessZombies(SlimDX.Direct3D9.Device device)
        {
            var m = Medium(device);
            Action <int, int> insertGrunt = null;

            insertGrunt = (int x, int y) =>
            {
                Map.Units.Grunt g;
                m.DynamicsRoot.AddChild(g = new Map.Units.Grunt
                {
                    Position = new SlimDX.Vector3(37 + x * 1, 37 + y * 1, 0),
                });
                g.ClearAbilities();
                g.Killed += new Client.Game.Map.Destructible.KilledEventHandler((o, e, s) =>
                {
                    insertGrunt(x, y);
                    if (!g.IsRemoved)
                    {
                        g.Remove();
                    }
                });
            };
            for (int y = 0; y < 5; y++)
            {
                for (int x = 0; x < 5; x++)
                {
                    insertGrunt(x, y);
                }
            }
            m.MainCharacter.PistolAmmo = 100;
            return(m);
        }
        public static Map.Map ChallengeClericAndBull(SlimDX.Direct3D9.Device device)
        {
            var m = Medium(device);

            for (int y = 0; y < 5; y++)
            {
                for (int x = 0; x < 5; x++)
                {
                    m.DynamicsRoot.AddChild(new Map.Units.Grunt
                    {
                        Translation = new SlimDX.Vector3(22 + x * 3, 22 + y * 3, 0),
                        State       = Map.UnitState.Alive
                    });
                }
            }
            m.DynamicsRoot.AddChild(new Map.Units.Cleric {
                Translation = new SlimDX.Vector3(25, 25, 0)
            });
            for (int i = 0; i < 10; i++)
            {
                m.DynamicsRoot.AddChild(new Map.Units.Bull
                {
                    Translation = new SlimDX.Vector3(25, 25, 0),
                    State       = Map.UnitState.RaisableCorpse
                });
            }
            return(m);
        }
Beispiel #11
0
 public void NewSplatMap2(SlimDX.Direct3D9.Device device)
 {
     Ground.SplatMap2           = new Graphics.Content.UnmanagedResource <SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D>();
     Ground.SplatMap2.Resource9 = new SlimDX.Direct3D9.Texture(device,
                                                               (int)settings.Size.Width * 4, (int)settings.Size.Height * 4, 1,
                                                               SlimDX.Direct3D9.Usage.Dynamic, SlimDX.Direct3D9.Format.A8R8G8B8,
                                                               SlimDX.Direct3D9.Pool.Default);
 }
 public override SlimDX.Direct3D9.Texture ToTexture9(SlimDX.Direct3D9.Device device)
 {
     SlimDX.Direct3D9.Texture t = new SlimDX.Direct3D9.Texture(device, Size.Width, Size.Height, 1, SlimDX.Direct3D9.Usage.Dynamic, Data[0, 0].Format9, SlimDX.Direct3D9.Pool.Default);
     SlimDX.DataRectangle     r = t.LockRectangle(0, SlimDX.Direct3D9.LockFlags.None);
     TextureUtil.WriteTexture(r, Data, Data[0, 0].Size);
     t.UnlockRectangle(0);
     return(t);
 }
Beispiel #13
0
        public static SlimDX.Direct3D9.Texture SingleColor <T>(SlimDX.Direct3D9.Device device, T color) where T : struct
        {
            SlimDX.Direct3D9.Texture t = new SlimDX.Direct3D9.Texture(device, 1, 1, 1, SlimDX.Direct3D9.Usage.Dynamic, SlimDX.Direct3D9.Format.A8R8G8B8, SlimDX.Direct3D9.Pool.Default);
            DataRectangle            r = t.LockRectangle(0, SlimDX.Direct3D9.LockFlags.None);

            r.Data.Write(color);
            t.UnlockRectangle(0);
            return(t);
        }
        public static Map.Map InformationPopupTest(SlimDX.Direct3D9.Device device)
        {
            var m = Tiny(device);

            m.Scripts.Add(new Client.Game.Map.InformationPopupScript {
                Text = "Information!", InitDelay = 2
            });
            return(m);
        }
        public static Map.Map SingleCleric(SlimDX.Direct3D9.Device device)
        {
            var m = Tiny(device);

            m.DynamicsRoot.AddChild(new Map.Units.Cleric
            {
                Position = new SlimDX.Vector3(5, 10, 0),
            });
            return(m);
        }
        public static Map.Map DestructibleTest(SlimDX.Direct3D9.Device device)
        {
            var m = Tiny(device);

            m.DynamicsRoot.AddChild(new Map.Props.Rottentree1
            {
                Position = new SlimDX.Vector3(7, 7, 0),
            });
            return(m);
        }
        public static Map.Map SingleBull(SlimDX.Direct3D9.Device device)
        {
            var m = Tiny(device);

            m.DynamicsRoot.AddChild(new Map.Units.Bull
            {
                Position = new SlimDX.Vector3(2, 8, 0),
            });
            return(m);
        }
        public Map Load(string filename, SlimDX.Direct3D9.Device device)
        {
            Map m;

            foreach (var v in GetLoadSteps(filename, device, out m))
            {
                v.Second();
            }
            return(m);
        }
        public static Map.Map SingleDemonLord(SlimDX.Direct3D9.Device device)
        {
            var m = Medium(device);

            m.DynamicsRoot.AddChild(new Map.Units.DemonLord
            {
                Position = new SlimDX.Vector3(32, 32, 0),
            });
            return(m);
        }
        public static Map.Map ChallengeInaccessibleCleric(SlimDX.Direct3D9.Device device)
        {
            var m = Medium(device);

            Graphics.Editors.GroundTextureEditor e = new Graphics.Editors.GroundTextureEditor
            {
                Size            = m.Settings.Size,
                SoftwareTexture = new Graphics.Software.Texture <Graphics.Software.Texel.R32F>[] { new Graphics.Software.Texture <Graphics.Software.Texel.R32F>(m.Ground.Heightmap) },
                Pencil          = new Graphics.Editors.GroundTexturePencil
                {
                    Color  = new SlimDX.Vector4(1, 0, 0, 0),
                    Radius = 5,
                    Type   = Graphics.Editors.GroundTexturePencilType.Add
                }
            };
            e.TextureValuesChanged += new Graphics.Editors.TextureValuesChangedEventHandler(
                (o, args) => m.Ground.UpdatePieceMeshes(args.ChangedRegion));

            e.Draw(new Vector2(22, 22), new Graphics.Editors.GroundTexturePencil
            {
                Radius = 7,
                Color  = new Vector4(-1, 0, 0, 0),
                Type   = Graphics.Editors.GroundTexturePencilType.Add
            });
            e.Draw(new Vector2(22, 22), new Graphics.Editors.GroundTexturePencil
            {
                Radius = 5,
                Color  = new Vector4(1, 0, 0, 0),
                Type   = Graphics.Editors.GroundTexturePencilType.Add
            });

            for (int y = 0; y < 5; y++)
            {
                for (int x = 0; x < 5; x++)
                {
                    m.DynamicsRoot.AddChild(new Map.Units.Grunt
                    {
                        Translation = new SlimDX.Vector3(25 + x * 2, 25 + y * 2, 0),
                        State       = Map.UnitState.Alive
                    });
                }
            }

            m.DynamicsRoot.AddChild(new Map.Units.Cleric {
                Translation = new SlimDX.Vector3(20, 20, 0)
            });
            foreach (var u in m.DynamicsRoot.Offspring)
            {
                if (u is Map.Unit)
                {
                    u.Translation = m.Ground.GetHeight(u.Translation) + Vector3.UnitZ * 0.1f;
                }
            }
            return(m);
        }
        public static Map.Map Tiny(SlimDX.Direct3D9.Device device)
        {
            var m = Map.Map.New(new Client.Game.Map.MapSettings {
                Size = new System.Drawing.SizeF(16, 16),
                Name = "Tiny"
            }, device);

            m.MainCharacter.Position   = new SlimDX.Vector3(10, 5, 0);
            m.MainCharacter.PistolAmmo = 1000000;
            return(m);
        }
        public static Map.Map Medium(SlimDX.Direct3D9.Device device)
        {
            var m = Map.Map.New(new Client.Game.Map.MapSettings
            {
                Size = new System.Drawing.SizeF(50, 50)
            }, device);

            m.MainCharacter.Position   = new SlimDX.Vector3(45, 45, 0);
            m.MainCharacter.PistolAmmo = 1000000;
            return(m);
        }
        public static Map.Map Large(SlimDX.Direct3D9.Device device)
        {
            var m = Map.Map.New(new Client.Game.Map.MapSettings
            {
                Size = new System.Drawing.SizeF(300, 300),
            }, device);

            m.MainCharacter.Position   = new SlimDX.Vector3(200, 200, 0);
            m.MainCharacter.PistolAmmo = 1000000;
            return(m);
        }
        public static Map.Map SingleInactiveGrunt(SlimDX.Direct3D9.Device device)
        {
            var m = Tiny(device);

            Map.Units.Grunt g;
            m.DynamicsRoot.AddChild(g = new Map.Units.Grunt
            {
                Position = new SlimDX.Vector3(2, 8, 0),
            });
            g.ClearAbilities();
            return(m);
        }
Beispiel #25
0
        /// <summary>
        /// Capture a region of the screen using Direct3D
        /// </summary>
        /// <param name="handle">The handle of a window</param>
        /// <param name="region">The region to capture (in screen coordinates)</param>
        /// <returns>A bitmap containing the captured region, this should be disposed of appropriately when finished with it</returns>
        public static Bitmap CaptureRegionDirect3D(IntPtr handle, Rectangle region)
        {
            IntPtr hWnd   = handle;
            Bitmap bitmap = null;

            // We are only supporting the primary display adapter for Direct3D mode
            SlimDX.Direct3D9.AdapterInformation adapterInfo = _direct3D9.Adapters.DefaultAdapter;
            SlimDX.Direct3D9.Device             device;

            #region Get Direct3D Device

            // Retrieve the existing Direct3D device if we already created one for the given handle
            if (_direct3DDeviceCache.ContainsKey(hWnd))
            {
                device = _direct3DDeviceCache[hWnd];
            }
            // We need to create a new device
            else
            {
                // Setup the device creation parameters
                SlimDX.Direct3D9.PresentParameters parameters = new SlimDX.Direct3D9.PresentParameters();
                parameters.BackBufferFormat = adapterInfo.CurrentDisplayMode.Format;
                Rectangle clientRect = NativeMethods.GetAbsoluteClientRect(hWnd);
                parameters.BackBufferHeight             = clientRect.Height;
                parameters.BackBufferWidth              = clientRect.Width;
                parameters.Multisample                  = SlimDX.Direct3D9.MultisampleType.None;
                parameters.SwapEffect                   = SlimDX.Direct3D9.SwapEffect.Discard;
                parameters.DeviceWindowHandle           = hWnd;
                parameters.PresentationInterval         = SlimDX.Direct3D9.PresentInterval.Default;
                parameters.FullScreenRefreshRateInHertz = 0;

                // Create the Direct3D device
                device = new SlimDX.Direct3D9.Device(_direct3D9, adapterInfo.Adapter, SlimDX.Direct3D9.DeviceType.Hardware, hWnd, SlimDX.Direct3D9.CreateFlags.SoftwareVertexProcessing, parameters);
                _direct3DDeviceCache.Add(hWnd, device);
            }

            #endregion

            // Capture the screen and copy the region into a Bitmap
            using (
                SlimDX.Direct3D9.Surface surface = SlimDX.Direct3D9.Surface.CreateOffscreenPlain(device, adapterInfo.CurrentDisplayMode.Width, adapterInfo.CurrentDisplayMode.Height, SlimDX.Direct3D9.Format.A8R8G8B8,
                                                                                                 SlimDX.Direct3D9.Pool.SystemMemory))
            {
                device.GetFrontBufferData(0, surface);

                // Update: thanks digitalutopia1 for pointing out that SlimDX have fixed a bug
                // where they previously expected a RECT type structure for their Rectangle
                bitmap = new Bitmap(SlimDX.Direct3D9.Surface.ToStream(surface, SlimDX.Direct3D9.ImageFileFormat.Bmp, new Rectangle(region.Left, region.Top, region.Width, region.Height)));
                // Previous SlimDX bug workaround: new Rectangle(region.Left, region.Top, region.Right, region.Bottom)));
            }

            return(bitmap);
        }
        public static Map.Map SingleDeadGrunt(SlimDX.Direct3D9.Device device)
        {
            var m = Tiny(device);

            Map.Units.Grunt g;
            m.DynamicsRoot.AddChild(g = new Map.Units.Grunt
            {
                Position = new SlimDX.Vector3(2, 8, 0),
                State    = Map.UnitState.Dead
            });
            return(m);
        }
        public static Map.Map ChallengeSingleBull(SlimDX.Direct3D9.Device device)
        {
            var m = Medium(device);

            m.MainCharacter.Translation = new Vector3(25, 25, 0);
            m.MainCharacter.PistolAmmo  = 10;
            m.DynamicsRoot.AddChild(new Map.Units.Bull
            {
                Translation = new SlimDX.Vector3(20, 20, 0),
            });
            return(m);
        }
        public static Map.Map SingleWolfBoss(SlimDX.Direct3D9.Device device)
        {
            var m = Medium(device);
            var w = new Map.Units.WolfBoss
            {
                Position = new SlimDX.Vector3(32, 32, 0),
            };

            w.EditorInit();
            m.DynamicsRoot.AddChild(w);
            return(m);
        }
        public static Map.Map ChainPull(SlimDX.Direct3D9.Device device)
        {
            var m = Medium(device);

            m.DynamicsRoot.AddChild(new Map.Units.Grunt {
                Position = new SlimDX.Vector3(36, 36, 0)
            });
            m.DynamicsRoot.AddChild(new Map.Units.Grunt {
                Position = new SlimDX.Vector3(31, 31, 0)
            });
            return(m);
        }
        public static Map.Map ChainPullRaisable(SlimDX.Direct3D9.Device device)
        {
            var m = Medium(device);

            m.DynamicsRoot.AddChild(new Map.Units.Grunt {
                Position = new SlimDX.Vector3(36, 36, 0), State = Client.Game.Map.UnitState.RaisableCorpse
            });
            m.DynamicsRoot.AddChild(new Map.Units.Grunt {
                Position = new SlimDX.Vector3(31, 31, 0), State = Client.Game.Map.UnitState.RaisableCorpse
            });
            return(m);
        }
Beispiel #31
0
        /// <summary>
        /// Capture a region of the screen using Direct3D
        /// </summary>
        /// <param name="handle">The handle of a window</param>
        /// <param name="region">The region to capture (in screen coordinates)</param>
        /// <returns>A bitmap containing the captured region, this should be disposed of appropriately when finished with it</returns>
        public static Bitmap CaptureRegionDirect3D(IntPtr handle, Rectangle region)
        {
            IntPtr hWnd = handle;
            Bitmap bitmap = null;

            // We are only supporting the primary display adapter for Direct3D mode
            SlimDX.Direct3D9.AdapterInformation adapterInfo = _direct3D9.Adapters.DefaultAdapter;
            SlimDX.Direct3D9.Device device;

            #region Get Direct3D Device
            // Retrieve the existing Direct3D device if we already created one for the given handle
            if (_direct3DDeviceCache.ContainsKey (hWnd))
            {
                device = _direct3DDeviceCache [hWnd];
            }
            // We need to create a new device
            else
            {
                // Setup the device creation parameters
                SlimDX.Direct3D9.PresentParameters parameters = new SlimDX.Direct3D9.PresentParameters ();
                parameters.BackBufferFormat = adapterInfo.CurrentDisplayMode.Format;
                Rectangle clientRect = NativeMethods.GetAbsoluteClientRect (hWnd);
                parameters.BackBufferHeight = clientRect.Height;
                parameters.BackBufferWidth = clientRect.Width;
                parameters.Multisample = SlimDX.Direct3D9.MultisampleType.None;
                parameters.SwapEffect = SlimDX.Direct3D9.SwapEffect.Discard;
                parameters.DeviceWindowHandle = hWnd;
                parameters.PresentationInterval = SlimDX.Direct3D9.PresentInterval.Default;
                parameters.FullScreenRefreshRateInHertz = 0;

                // Create the Direct3D device
                device = new SlimDX.Direct3D9.Device (_direct3D9, adapterInfo.Adapter, SlimDX.Direct3D9.DeviceType.Hardware, hWnd, SlimDX.Direct3D9.CreateFlags.SoftwareVertexProcessing, parameters);
                _direct3DDeviceCache.Add (hWnd, device);
            }
            #endregion

            // Capture the screen and copy the region into a Bitmap
            using (SlimDX.Direct3D9.Surface surface = SlimDX.Direct3D9.Surface.CreateOffscreenPlain (device, adapterInfo.CurrentDisplayMode.Width, adapterInfo.CurrentDisplayMode.Height, SlimDX.Direct3D9.Format.A8R8G8B8, SlimDX.Direct3D9.Pool.SystemMemory))
            {
                device.GetFrontBufferData (0, surface);

                // Update: thanks digitalutopia1 for pointing out that SlimDX have fixed a bug
                // where they previously expected a RECT type structure for their Rectangle
                //Rectangle r = new Rectangle (region.Left, region.Top, region.Width, region.Height);
                bitmap = new Bitmap (SlimDX.Direct3D9.Surface.ToStream (surface, SlimDX.Direct3D9.ImageFileFormat.Bmp));
                // Previous SlimDX bug workaround: new Rectangle(region.Left, region.Top, region.Right, region.Bottom)));

            }

            return bitmap;
        }
Beispiel #32
0
 public TextureManager(SlimDX.Direct3D9.Device dev)
 {
     mDevice = dev;
     ErrorTexture = fromMemoryGDI(Resources.Images.Error);
 }