Exemplo n.º 1
0
        public void DrawUp(int index, int x, int y)
        {
            if (x >= Settings.ScreenWidth)
            {
                return;
            }

            if (!CheckImage(index))
            {
                return;
            }

            MImage mi = _images[index];

            y -= mi.Height;
            if (y >= Settings.ScreenHeight)
            {
                return;
            }
            if (x + mi.Width < 0 || y + mi.Height < 0)
            {
                return;
            }

            DXManager.Sprite.Draw(mi.Image, new Rectangle(0, 0, mi.Width, mi.Height), Vector3.Zero, new Vector3(x, y, 0.0F), Color.White);
            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
Exemplo n.º 2
0
        public void Draw(int index, Point point, Size size, Color colour)
        {
            if (!CheckImage(index))
            {
                return;
            }

            MImage mi = _images[index];

            if (point.X >= Settings.ScreenWidth || point.Y >= Settings.ScreenHeight || point.X + size.Width < 0 || point.Y + size.Height < 0)
            {
                return;
            }

            float scaleX = (float)size.Width / mi.Width;
            float scaleY = (float)size.Height / mi.Height;

            Matrix matrix = Matrix.Scaling(scaleX, scaleY, 0);

            DXManager.Sprite.Transform = matrix;
            DXManager.Sprite.Draw(mi.Image, new Rectangle(0, 0, mi.Width, mi.Height), Vector3.Zero, new Vector3((float)point.X / scaleX, (float)point.Y / scaleY, 0.0F), Color.White);
            DXManager.Sprite.Transform = Matrix.Identity;

            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
Exemplo n.º 3
0
        public void DrawTinted(int index, Point point, Color colour, Color Tint, bool offSet = false)
        {
            if (!CheckImage(index))
            {
                return;
            }

            MImage mi = _images[index];

            if (offSet)
            {
                point.Offset(mi.X, mi.Y);
            }

            if (point.X >= Settings.ScreenWidth || point.Y >= Settings.ScreenHeight || point.X + mi.Width < 0 || point.Y + mi.Height < 0)
            {
                return;
            }

            DXManager.Sprite.Draw(mi.Image, new Rectangle(0, 0, mi.Width, mi.Height), Vector3.Zero, new Vector3((float)point.X, (float)point.Y, 0.0F), colour);

            if (mi.HasMask)
            {
                DXManager.Sprite.Draw(mi.MaskImage, new Rectangle(0, 0, mi.Width, mi.Height), Vector3.Zero, new Vector3((float)point.X, (float)point.Y, 0.0F), Tint);
            }

            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
Exemplo n.º 4
0
        public void DrawBlend(int index, Point point, Color colour, bool offSet = false, float rate = 1)
        {
            if (!CheckImage(index))
            {
                return;
            }

            MImage mi = _images[index];

            if (offSet)
            {
                point.Offset(mi.X, mi.Y);
            }

            if (point.X >= Settings.ScreenWidth || point.Y >= Settings.ScreenHeight || point.X + mi.Width < 0 || point.Y + mi.Height < 0)
            {
                return;
            }

            bool oldBlend = DXManager.Blending;

            DXManager.SetBlend(true, rate);

            DXManager.Sprite.Draw(mi.Image, new Rectangle(0, 0, mi.Width, mi.Height), Vector3.Zero, new Vector3((float)point.X, (float)point.Y, 0.0F), colour);

            DXManager.SetBlend(oldBlend);
            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
Exemplo n.º 5
0
        public void Draw(int index, Rectangle section, Point point, Color colour, float opacity)
        {
            if (!CheckImage(index))
            {
                return;
            }

            MImage mi = _images[index];


            if (point.X >= Settings.ScreenWidth || point.Y >= Settings.ScreenHeight || point.X + mi.Width < 0 || point.Y + mi.Height < 0)
            {
                return;
            }

            if (section.Right > mi.Width)
            {
                section.Width -= section.Right - mi.Width;
            }

            if (section.Bottom > mi.Height)
            {
                section.Height -= section.Bottom - mi.Height;
            }

            float oldOpacity = DXManager.Opacity;

            DXManager.SetOpacity(opacity);

            DXManager.Sprite.Draw(mi.Image, section, Vector3.Zero, new Vector3((float)point.X, (float)point.Y, 0.0F), colour);

            DXManager.SetOpacity(oldOpacity);
            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
Exemplo n.º 6
0
        public Size GetTrueSize(int index)
        {
            if (!_initialized)
            {
                Initialize();
            }

            if (_images == null || index < 0 || index >= _images.Length)
            {
                return(Size.Empty);
            }

            if (_images[index] == null)
            {
                _fStream.Position = _indexList[index];
                _images[index]    = new MImage(_reader);
            }
            MImage mi = _images[index];

            if (mi.TrueSize.IsEmpty)
            {
                if (!mi.TextureValid)
                {
                    if ((mi.Width == 0) || (mi.Height == 0))
                    {
                        return(Size.Empty);
                    }

                    _fStream.Seek(_indexList[index] + 17, SeekOrigin.Begin);
                    mi.CreateTexture(_reader);
                }
                return(mi.GetTrueSize());
            }
            return(mi.TrueSize);
        }
Exemplo n.º 7
0
        public void Draw(int index, Point point, Color colour, bool offSet, float opacity)
        {
            if (!CheckImage(index))
            {
                return;
            }

            MImage mi = _images[index];

            if (offSet)
            {
                point.Offset(mi.X, mi.Y);
            }

            if (point.X >= Settings.ScreenWidth || point.Y >= Settings.ScreenHeight || point.X + mi.Width < 0 || point.Y + mi.Height < 0)
            {
                return;
            }

            float oldOpacity = DXManager.Opacity;

            DXManager.SetOpacity(opacity);

            DXManager.Sprite.Draw(mi.Image, new Rectangle(0, 0, mi.Width, mi.Height), Vector3.Zero, new Vector3((float)point.X, (float)point.Y, 0.0F), colour);

            DXManager.SetOpacity(oldOpacity);
            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
Exemplo n.º 8
0
        private bool CheckImage(int index)
        {
            if (!_initialized)
            {
                Initialize();
            }

            if (_images == null || index < 0 || index >= _images.Length)
            {
                return(false);
            }

            if (_images[index] == null)
            {
                _fStream.Position = _indexList[index];
                _images[index]    = new MImage(_reader);
            }
            MImage mi = _images[index];

            if (!mi.TextureValid)
            {
                if ((mi.Width == 0) || (mi.Height == 0))
                {
                    return(false);
                }
                _fStream.Seek(_indexList[index] + 17, SeekOrigin.Begin);
                mi.CreateTexture(_reader);
            }

            return(true);
        }
Exemplo n.º 9
0
        public void DrawUpBlend(int index, Point point)
        {
            if (!CheckImage(index))
            {
                return;
            }

            MImage mi = _images[index];

            point.Y -= mi.Height;


            if (point.X >= Settings.ScreenWidth || point.Y >= Settings.ScreenHeight || point.X + mi.Width < 0 || point.Y + mi.Height < 0)
            {
                return;
            }

            bool oldBlend = DXManager.Blending;

            DXManager.SetBlend(true, 1);

            DXManager.Sprite.Draw2D(mi.Image, Point.Empty, 0, point, Color.White);

            DXManager.SetBlend(oldBlend);
            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
Exemplo n.º 10
0
        public void DrawUp(int index, int x, int y)
        {
            if (x >= Settings.ScreenWidth)
            {
                return;
            }

            if (!CheckImage(index))
            {
                return;
            }

            MImage mi = _images[index];

            y -= mi.Height;
            if (y >= Settings.ScreenHeight)
            {
                return;
            }
            if (x + mi.Width < 0 || y + mi.Height < 0)
            {
                return;
            }


            DXManager.Sprite.Draw2D(mi.Image, Point.Empty, 0, new PointF(x, y), Color.White);
            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
Exemplo n.º 11
0
        public void Draw(int index, Rectangle section, Point point, Color colour, bool offSet)
        {
            if (!CheckImage(index))
            {
                return;
            }

            MImage mi = _images[index];

            if (offSet)
            {
                point.Offset(mi.X, mi.Y);
            }


            if (point.X >= Settings.ScreenWidth || point.Y >= Settings.ScreenHeight || point.X + mi.Width < 0 || point.Y + mi.Height < 0)
            {
                return;
            }

            if (section.Right > mi.Width)
            {
                section.Width -= section.Right - mi.Width;
            }

            if (section.Bottom > mi.Height)
            {
                section.Height -= section.Bottom - mi.Height;
            }

            DXManager.Sprite.Draw2D(mi.Image, section, section.Size, point, colour);
            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
Exemplo n.º 12
0
        public void DrawUpBlend(int index, Point point)
        {
            if (!CheckImage(index))
            {
                return;
            }

            MImage mi = _images[index];

            point.Y -= mi.Height;


            if (point.X >= Settings.ScreenWidth || point.Y >= Settings.ScreenHeight || point.X + mi.Width < 0 || point.Y + mi.Height < 0)
            {
                return;
            }

            bool oldBlend = DXManager.Blending;

            DXManager.SetBlend(true, 1);

            DXManager.Sprite.Draw(mi.Image, new Rectangle(0, 0, mi.Width, mi.Height), Vector3.Zero, new Vector3((float)point.X, (float)point.Y, 0.0F), Color.White);

            DXManager.SetBlend(oldBlend);
            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
Exemplo n.º 13
0
        public void Draw(int index, Point point, Color colour, bool offSet, float opacity)
        {
            if (!CheckImage(index))
            {
                return;
            }

            MImage mi = _images[index];

            if (offSet)
            {
                point.Offset(mi.X, mi.Y);
            }


            if (point.X >= Settings.ScreenWidth || point.Y >= Settings.ScreenHeight || point.X + mi.Width < 0 || point.Y + mi.Height < 0)
            {
                return;
            }

            float oldOpacity = DXManager.Opacity;

            DXManager.SetOpacity(opacity);

            DXManager.Sprite.Draw2D(mi.Image, Point.Empty, 0, point, colour);
            DXManager.SetOpacity(oldOpacity);
            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
Exemplo n.º 14
0
        public void Draw(int index, Point point, Size size, Color colour)
        {
            if (!CheckImage(index))
            {
                return;
            }

            MImage mi = _images[index];

            if (point.X >= Settings.ScreenWidth || point.Y >= Settings.ScreenHeight || point.X + size.Width < 0 || point.Y + size.Height < 0)
            {
                return;
            }

            DXManager.Sprite.Draw2D(mi.Image, new Rectangle(Point.Empty, new Size(mi.Width, mi.Height)), size, point, colour);
            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
Exemplo n.º 15
0
        public Size GetSize(int index)
        {
            if (!_initialized)
            {
                Initialize();
            }
            if (_images == null || index < 0 || index >= _images.Length)
            {
                return(Size.Empty);
            }

            if (_images[index] == null)
            {
                _fStream.Seek(_indexList[index], SeekOrigin.Begin);
                _images[index] = new MImage(_reader);
            }

            return(new Size(_images[index].Width, _images[index].Height));
        }
Exemplo n.º 16
0
        public static void Clean()
        {
            for (int i = TextureList.Count - 1; i >= 0; i--)
            {
                MImage m = TextureList[i];

                if (m == null)
                {
                    TextureList.RemoveAt(i);
                    continue;
                }

                if (CMain.Time <= m.CleanTime)
                {
                    continue;
                }


                TextureList.RemoveAt(i);
                if (m.Image != null && !m.Image.Disposed)
                {
                    m.Image.Dispose();
                }
            }

            for (int i = ControlList.Count - 1; i >= 0; i--)
            {
                MirControl c = ControlList[i];

                if (c == null)
                {
                    ControlList.RemoveAt(i);
                    continue;
                }

                if (CMain.Time <= c.CleanTime)
                {
                    continue;
                }

                c.DisposeTexture();
            }
        }
Exemplo n.º 17
0
        public Point GetOffSet(int index)
        {
            if (!_initialized)
            {
                Initialize();
            }

            if (_images == null || index < 0 || index >= _images.Length)
            {
                return(Point.Empty);
            }

            if (_images[index] == null)
            {
                _fStream.Seek(_indexList[index], SeekOrigin.Begin);
                _images[index] = new MImage(_reader);
            }

            return(new Point(_images[index].X, _images[index].Y));
        }
Exemplo n.º 18
0
        public void Draw(int index, Point point, Color colour, bool offSet = false)
        {
            if (!CheckImage(index))
            {
                return;
            }

            MImage mi = _images[index];

            if (offSet)
            {
                point.Offset(mi.X, mi.Y);
            }

            if (point.X >= Settings.ScreenWidth || point.Y >= Settings.ScreenHeight || point.X + mi.Width < 0 || point.Y + mi.Height < 0)
            {
                return;
            }

            DXManager.Sprite.Draw(mi.Image, colour.ToRawColorBGRA(), new RawRectangle(0, 0, mi.Width, mi.Height), Vector3.Zero, new Vector3(point.X, point.Y, 0.0F));

            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
Exemplo n.º 19
0
        public void DrawTinted(int index, Point point, Color colour, Color Tint)
        {
            if (!CheckImage(index))
            {
                return;
            }

            MImage mi = _images[index];

            if (point.X >= Settings.ScreenWidth || point.Y >= Settings.ScreenHeight || point.X + mi.Width < 0 || point.Y + mi.Height < 0)
            {
                return;
            }
            DXManager.Sprite.Draw2D(mi.Image, Point.Empty, 0, point, colour);

            if (mi.HasMask != true)
            {
                return;
            }
            DXManager.Sprite.Draw2D(mi.MaskImage, Point.Empty, 0, point, Tint);

            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
Exemplo n.º 20
0
        public void Draw(int index, int x, int y)
        {
            if (x >= Settings.ScreenWidth || y >= Settings.ScreenHeight)
            {
                return;
            }

            if (!CheckImage(index))
            {
                return;
            }

            MImage mi = _images[index];

            if (x + mi.Width < 0 || y + mi.Height < 0)
            {
                return;
            }


            DXManager.Draw(mi.Image, new Rectangle(0, 0, mi.Width, mi.Height), new Vector3((float)x, (float)y, 0.0F), Color.White);

            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
Exemplo n.º 21
0
        public Size GetTrueSize(int index)
        {
            if (!_initialized)
                Initialize();

            if (_images == null || index < 0 || index >= _images.Length)
                return Size.Empty;

            if (_images[index] == null)
            {
                _fStream.Position = _indexList[index];
                _images[index] = new MImage(_reader);
            }
            MImage mi = _images[index];
            if (mi.TrueSize.IsEmpty)
            {
                if (!mi.TextureValid)
                {
                    if ((mi.Width == 0) || (mi.Height == 0))
                        return Size.Empty;

                    _fStream.Seek(_indexList[index] + 17, SeekOrigin.Begin);
                    mi.CreateTexture(_reader);
                }
                return mi.GetTrueSize();
            }
            return mi.TrueSize;
        }
Exemplo n.º 22
0
        public Size GetSize(int index)
        {
            if (!_initialized) Initialize();
            if (_images == null || index < 0 || index >= _images.Length)
                return Size.Empty;

            if (_images[index] == null)
            {
                _fStream.Seek(_indexList[index], SeekOrigin.Begin);
                _images[index] = new MImage(_reader);
            }

            return new Size(_images[index].Width, _images[index].Height);
        }
Exemplo n.º 23
0
        public Point GetOffSet(int index)
        {
            if (!_initialized) Initialize();

            if (_images == null || index < 0 || index >= _images.Length)
                return Point.Empty;

            if (_images[index] == null)
            {
                _fStream.Seek(_indexList[index], SeekOrigin.Begin);
                _images[index] = new MImage(_reader);
            }

            return new Point(_images[index].X, _images[index].Y);
        }
Exemplo n.º 24
0
        private bool CheckImage(int index)
        {
            if (!_initialized)
                Initialize();

            if (_images == null || index < 0 || index >= _images.Length)
                return false;


            if (_images[index] == null)
            {
                _fStream.Position = _indexList[index];
                _images[index] = new MImage(_reader);
            }
            MImage mi = _images[index];
            if (!mi.TextureValid)
            {
                if ((mi.Width == 0) || (mi.Height == 0))
                    return false;
                _fStream.Seek(_indexList[index] + 17, SeekOrigin.Begin);
                mi.CreateTexture(_reader);
            }

            return true;
        }
Exemplo n.º 25
0
        private static void CleanUp()
        {
            if (Sprite != null)
            {
                if (!Sprite.Disposed)
                {
                    Sprite.Dispose();
                }

                Sprite = null;
            }

            if (Line != null)
            {
                if (!Line.Disposed)
                {
                    Line.Dispose();
                }

                Line = null;
            }

            if (CurrentSurface != null)
            {
                if (!CurrentSurface.Disposed)
                {
                    CurrentSurface.Dispose();
                }

                CurrentSurface = null;
            }

            if (PoisonDotBackground != null)
            {
                if (!PoisonDotBackground.Disposed)
                {
                    PoisonDotBackground.Dispose();
                }

                PoisonDotBackground = null;
            }

            if (RadarTexture != null)
            {
                if (!RadarTexture.Disposed)
                {
                    RadarTexture.Dispose();
                }

                RadarTexture = null;
            }

            if (FloorTexture != null)
            {
                if (!FloorTexture.Disposed)
                {
                    FloorTexture.Dispose();
                }

                DXManager.FloorTexture = null;
                GameScene.Scene.MapControl.FloorValid = false;

                if (DXManager.FloorSurface != null && !DXManager.FloorSurface.Disposed)
                {
                    DXManager.FloorSurface.Dispose();
                }

                DXManager.FloorSurface = null;
            }

            if (LightTexture != null)
            {
                if (!LightTexture.Disposed)
                {
                    LightTexture.Dispose();
                }

                DXManager.LightTexture = null;

                if (DXManager.LightSurface != null && !DXManager.LightSurface.Disposed)
                {
                    DXManager.LightSurface.Dispose();
                }

                DXManager.LightSurface = null;
            }

            if (Lights != null)
            {
                for (int i = 0; i < Lights.Count; i++)
                {
                    if (!Lights[i].Disposed)
                    {
                        Lights[i].Dispose();
                    }
                }
                Lights.Clear();
            }

            for (int i = TextureList.Count - 1; i >= 0; i--)
            {
                MImage m = TextureList[i];

                if (m == null)
                {
                    continue;
                }

                m.DisposeTexture();
            }
            TextureList.Clear();


            for (int i = ControlList.Count - 1; i >= 0; i--)
            {
                MirControl c = ControlList[i];

                if (c == null)
                {
                    continue;
                }

                c.DisposeTexture();
            }
            ControlList.Clear();
        }