示例#1
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;
        }
示例#2
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.Draw2D(mi.Image, Point.Empty, 0, point, colour);

            DXManager.SetBlend(oldBlend);
            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
示例#3
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.Draw2D(mi.Image, section, section.Size, point, colour);

            DXManager.SetOpacity(oldOpacity);
            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
示例#4
0
文件: DXManager.cs 项目: xiaoweb/mir2
        public static void ResetDevice()
        {
            DXManager.CleanUp();
            DXManager.DeviceLost = true;

            if (DXManager.Parameters == null)
            {
                return;
            }

            Size clientSize = Program.Form.ClientSize;

            if (clientSize.Width == 0 || clientSize.Height == 0)
            {
                return;
            }

            DXManager.Parameters.Windowed             = !Settings.FullScreen;
            DXManager.Parameters.BackBufferWidth      = clientSize.Width;
            DXManager.Parameters.BackBufferHeight     = clientSize.Height;
            DXManager.Parameters.PresentationInterval = Settings.FPSCap ? PresentInterval.Default : PresentInterval.Immediate;
            DXManager.Device.Reset(DXManager.Parameters);

            DXManager.LoadTextures();
        }
示例#5
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;
        }
示例#6
0
文件: MLibrary.cs 项目: woncc/mir2-1
        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;
        }
示例#7
0
文件: DXManager.cs 项目: xiaoweb/mir2
        public static void AttemptReset()
        {
            try
            {
                Result result = DXManager.Device.TestCooperativeLevel();
                if (result.Code == ResultCode.DeviceLost.Code)
                {
                    return;
                }

                int code = result.Code;
                if (code == ResultCode.DeviceNotReset.Code)
                {
                    DXManager.ResetDevice();
                }
                else
                {
                    if (code != ResultCode.Success.Code)
                    {
                        return;
                    }

                    DXManager.DeviceLost = false;
                }
            }
            catch
            {
            }
        }
示例#8
0
文件: MLibrary.cs 项目: woncc/mir2-1
        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;
        }
示例#9
0
文件: MLibrary.cs 项目: robbobby/mir2
        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);
            CMain.DPSCounter++;

            DXManager.SetBlend(oldBlend);
            mi.CleanTime = CMain.Time + Settings.CleanDelay;
        }
示例#10
0
        public void Draw(int Index, Point Location, Color Colour, float Opacity = 1F, bool OffSet = false)
        {
            if (!CheckImage(Index))
            {
                return;
            }

            if (OffSet)
            {
                Location.Offset(ImageList[Index].OffSet);
            }

            float OldOpacity = DXManager.Opacity;

            if (Opacity < 1F)
            {
                DXManager.SetOpacity(Opacity);
            }

            DXManager.Sprite.Draw2D(ImageList[Index].ImageTexture, Point.Empty, 0, Location, Colour.ToArgb());

            if (Opacity < 1F)
            {
                DXManager.SetOpacity(OldOpacity);
            }
        }
示例#11
0
        public void DrawBlend(int Index, Point Location, Color Colour, bool OffSet = false)
        {
            if (!CheckImage(Index))
            {
                return;
            }

            if (OffSet)
            {
                Location.Offset(ImageList[Index].OffSet);
            }

            DXManager.SetBlend(true);
            DXManager.Sprite.Draw2D(ImageList[Index].ImageTexture, Point.Empty, 0, Location, Colour);
            DXManager.SetBlend(false);
        }
示例#12
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;
        }
示例#13
0
        public void Draw(int Index, Rectangle Section, Point Location, Color Colour, float Opacity = 1F, bool OffSet = false)
        {
            if (!CheckImage(Index))
            {
                return;
            }

            if (OffSet)
            {
                Section.Offset(ImageList[Index].OffSet);
            }

            if (Section.Right > ImageList[Index].Size.Width)
            {
                Section.Width -= Section.Right - ImageList[Index].Size.Width;
            }

            if (Section.Bottom > ImageList[Index].Size.Height)
            {
                Section.Height -= Section.Bottom - ImageList[Index].Size.Height;
            }

            float OldOpacity = DXManager.Opacity;

            if (Opacity < 1F)
            {
                DXManager.SetOpacity(Opacity);
            }

            DXManager.Sprite.Draw2D(ImageList[Index].ImageTexture, Section, Section.Size, Location, Colour);

            if (Opacity < 1F)
            {
                DXManager.SetOpacity(OldOpacity);
            }
        }