Example #1
0
        void DrawClsnBoxes(Vector2 location, Animations.AnimationElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            Video.DrawState drawstate = SpriteManager.DrawState;
            drawstate.Reset();

            drawstate.Mode = DrawMode.OutlinedRectangle;

            foreach (Animations.Clsn clsn in element)
            {
                Rectangle rect = clsn.MakeRect(location, CurrentScale, CurrentFacing);

                switch (clsn.ClsnType)
                {
                case ClsnType.Type1Attack:
                    drawstate.AddData(new Vector2(rect.X, rect.Y), new Rectangle(0, 0, rect.Width, rect.Height), Color.Red);
                    break;

                case ClsnType.Type2Normal:
                    drawstate.AddData(new Vector2(rect.X, rect.Y), new Rectangle(0, 0, rect.Width, rect.Height), Color.Blue);
                    break;
                }
            }

            drawstate.Use();
        }
Example #2
0
        public override void Draw(Combat.PaletteFx palettefx)
        {
            Point tilestart;
            Point tileend;

            GetTileLength(Sprite.Size, out tilestart, out tileend);

            Video.DrawState drawstate = SpriteManager.DrawState;
            drawstate.Reset();
            drawstate.Blending         = Transparency;
            drawstate.ScissorRectangle = DrawRect;
            drawstate.Set(Sprite);

            for (Int32 y = tilestart.Y; y != tileend.Y; ++y)
            {
                for (Int32 x = tilestart.X; x != tileend.X; ++x)
                {
                    Vector2 adjustment = (Vector2)(Sprite.Size + TilingSpacing) * new Vector2(x, y);
                    Vector2 location   = CurrentLocation + adjustment;

                    drawstate.AddData(location, null);
                }
            }

            if (palettefx != null)
            {
                palettefx.SetShader(drawstate.ShaderParameters);
            }

            drawstate.Use();
        }
Example #3
0
        public override void Draw(Combat.PaletteFx palettefx)
        {
            Drawing.Sprite sprite = SpriteManager.GetSprite(AnimationManager.CurrentElement.SpriteId);
            if (sprite == null)
            {
                return;
            }

            Point tilestart;
            Point tileend;

            GetTileLength(sprite.Size, out tilestart, out tileend);

            Video.DrawState drawstate = SpriteManager.DrawState;
            drawstate.Reset();
            drawstate.Blending = Transparency;
            drawstate.Set(sprite);
            drawstate.AddData(CurrentLocation, null);

            if (palettefx != null)
            {
                palettefx.SetShader(drawstate.ShaderParameters);
            }

            drawstate.Use();
        }
Example #4
0
		public SpriteManager(SpriteFile spritefile)
		{
			if (spritefile == null) throw new ArgumentNullException("spritefile");

			m_spritefile = spritefile;
			m_drawstate = new Video.DrawState(m_spritefile.SpriteSystem.GetSubSystem<Video.VideoSystem>());
		}
Example #5
0
        public Font(SpriteSystem spritesystem, String filepath, Sprite sprite, ReadOnlyDictionary <Char, Rectangle> sizemap, Point charsize, Int32 colors)
        {
            if (spritesystem == null)
            {
                throw new ArgumentNullException("spritesystem");
            }
            if (filepath == null)
            {
                throw new ArgumentNullException("filepath");
            }
            if (sprite == null)
            {
                throw new ArgumentNullException("sprite");
            }
            if (sizemap == null)
            {
                throw new ArgumentNullException("sizemap");
            }

            m_spritesystem = spritesystem;
            m_filepath     = filepath;
            m_sprite       = sprite;
            m_sizemap      = sizemap;
            m_charsize     = charsize;
            m_colors       = colors;
            m_drawstate    = new Video.DrawState(m_spritesystem.GetSubSystem <Video.VideoSystem>());
        }
Example #6
0
		public EnvironmentColor(FightEngine fightengine)
			: base(fightengine)
		{
			m_color = Vector3.Zero;
			m_time = 0;
			m_under = false;
			m_hiddenlist = new List<Entity>();
			m_drawstate = new Video.DrawState(Engine.GetSubSystem<Video.VideoSystem>());
		}
Example #7
0
 public EnvironmentColor(FightEngine fightengine)
     : base(fightengine)
 {
     m_color      = Vector3.Zero;
     m_time       = 0;
     m_under      = false;
     m_hiddenlist = new List <Entity>();
     m_drawstate  = new Video.DrawState(Engine.GetSubSystem <Video.VideoSystem>());
 }
Example #8
0
        public SpriteManager(SpriteFile spritefile)
        {
            if (spritefile == null)
            {
                throw new ArgumentNullException("spritefile");
            }

            m_spritefile = spritefile;
            m_drawstate  = new Video.DrawState(m_spritefile.SpriteSystem.GetSubSystem <Video.VideoSystem>());
        }
Example #9
0
        void DrawOriginCross(Vector2 location, Int32 segmentlength)
        {
            Video.DrawState drawstate = SpriteManager.DrawState;
            drawstate.Reset();

            drawstate.Mode = DrawMode.Lines;
            drawstate.AddData(location - new Vector2(segmentlength, 0), null, Color.Black);
            drawstate.AddData(location + new Vector2(segmentlength, 0), null, Color.Black);
            drawstate.AddData(location - new Vector2(0, segmentlength), null, Color.Black);
            drawstate.AddData(location + new Vector2(0, segmentlength), null, Color.Black);
            drawstate.Use();
        }
Example #10
0
        public void Draw()
        {
            if (IsActive == false)
            {
                return;
            }

            Int32 index = m_imagedata.Count;

            foreach (AfterImageSubdata data in m_imagedata)
            {
                --index;

                if (FrameGapCheck(index) == false)
                {
                    continue;
                }
                if (TimeCheck(index) == false)
                {
                    continue;
                }

                Drawing.Sprite sprite = m_entity.SpriteManager.GetSprite(data.Element.SpriteId);
                if (sprite == null)
                {
                    continue;
                }

                Vector2 drawlocation = data.Location + new Vector2(Mugen.ScreenSize.X / 2, m_entity.Engine.Stage.ZOffset);
                Vector2 drawoffset   = Misc.GetOffset(Vector2.Zero, data.Facing, data.Element.Offset);

                Video.DrawState drawstate = m_entity.SpriteManager.SetupDrawing(data.Element.SpriteId, drawlocation, drawoffset, data.Scale, data.Flip);

                drawstate.Rotation = data.DrawAngle;
                drawstate.Blending = Transparency ?? data.Transparency;

                drawstate.ShaderParameters.AfterImageEnable          = true;
                drawstate.ShaderParameters.AfterImageColor           = m_basecolor;
                drawstate.ShaderParameters.AfterImageConstrast       = m_constrast;
                drawstate.ShaderParameters.AfterImageInvert          = m_invertcolor;
                drawstate.ShaderParameters.AfterImageNumber          = index;
                drawstate.ShaderParameters.AfterImagePaletteAdd      = m_palettecoloradd;
                drawstate.ShaderParameters.AfterImagePaletteMultiply = m_palettecolormul;
                drawstate.ShaderParameters.AfterImagePostAdd         = m_postadd;
                drawstate.ShaderParameters.AfterImagePreAdd          = m_preadd;

                drawstate.Use();
            }
        }
Example #11
0
		public Font(SpriteSystem spritesystem, String filepath, Sprite sprite, ReadOnlyDictionary<Char, Rectangle> sizemap, Point charsize, Int32 colors)
		{
			if (spritesystem == null) throw new ArgumentNullException("spritesystem");
			if (filepath == null) throw new ArgumentNullException("filepath");
			if (sprite == null) throw new ArgumentNullException("sprite");
			if (sizemap == null) throw new ArgumentNullException("sizemap");

			m_spritesystem = spritesystem;
			m_filepath = filepath;
			m_sprite = sprite;
			m_sizemap = sizemap;
			m_charsize = charsize;
			m_colors = colors;
			m_drawstate = new Video.DrawState(m_spritesystem.GetSubSystem<Video.VideoSystem>());
		}
Example #12
0
        void DrawSpriteBox(Vector2 location, Animations.AnimationElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            Drawing.Sprite sprite = SpriteManager.GetSprite(element.SpriteId);
            if (sprite == null)
            {
                return;
            }

            Vector2       drawoffset = Vector2.Zero;
            SpriteEffects flip       = GetDrawFlip();

            switch (CurrentFacing)
            {
            case Facing.Right:
                drawoffset = (Vector2)element.Offset;
                break;

            case Facing.Left:
                drawoffset = new Vector2(-element.Offset.X, element.Offset.Y);
                break;
            }

            if ((flip & SpriteEffects.FlipHorizontally) == SpriteEffects.FlipHorizontally)
            {
                drawoffset.X = -drawoffset.X;
            }
            if ((flip & SpriteEffects.FlipVertically) == SpriteEffects.FlipVertically)
            {
                drawoffset.Y = -drawoffset.Y;
            }

            Video.DrawState drawstate = SpriteManager.DrawState;

            Vector2 spritelocation = Video.Renderer.GetDrawLocation(sprite.Size, location, (Vector2)sprite.Axis - drawoffset, CurrentScale, flip);

            drawstate.Reset();
            drawstate.Mode = DrawMode.OutlinedRectangle;
            drawstate.AddData(spritelocation, new Rectangle(0, 0, (Int32)(sprite.Size.X * CurrentScale.X), (Int32)(sprite.Size.Y * CurrentScale.Y)), Color.Gray);
            drawstate.Use();
        }
Example #13
0
        public override void DebugDraw()
        {
            base.DebugDraw();

            Video.DrawState drawstate = SpriteManager.DrawState;

            Vector2 offset = new Vector2(Mugen.ScreenSize.X / 2.0f, Engine.Stage.ZOffset);

            drawstate.Reset();
            drawstate.Mode = DrawMode.Lines;

            drawstate.AddData(new Vector2(GetBackLocation(), CurrentLocation.Y) + offset, null, new Color(255, 0, 255, 255));
            drawstate.AddData(CurrentLocation + offset, null, new Color(255, 0, 255, 255));

            drawstate.AddData(new Vector2(GetFrontLocation(), CurrentLocation.Y) + offset, null, new Color(255, 255, 0, 255));
            drawstate.AddData(CurrentLocation + offset, null, new Color(255, 255, 0, 255));

            drawstate.Use();
        }
Example #14
0
        public override void Draw(Vector2 location)
        {
            if (AnimationManager.HasAnimation(DataMap.AnimationNumber) == true)
            {
                Animations.AnimationElement element = AnimationManager.CurrentElement;
                if (element == null)
                {
                    return;
                }

                Drawing.Sprite sprite = SpriteManager.GetSprite(element.SpriteId);
                if (sprite == null)
                {
                    return;
                }

                Video.DrawState drawstate = SpriteManager.SetupDrawing(element.SpriteId, location, DataMap.Offset + element.Offset, DataMap.Scale, DataMap.Flip);
                drawstate.Blending = element.Blending;
                drawstate.Use();
            }
        }
Example #15
0
        public virtual void Draw()
        {
            AfterImages.Draw();

            Animations.AnimationElement currentelement = AnimationManager.CurrentElement;
            if (currentelement == null)
            {
                return;
            }

            Drawing.Sprite sprite = SpriteManager.GetSprite(currentelement.SpriteId);
            if (sprite == null)
            {
                return;
            }

            Vector2 drawlocation = GetDrawLocation();
            Vector2 drawoffset   = Misc.GetOffset(Vector2.Zero, CurrentFacing, currentelement.Offset);

            SpriteManager.OverridePalette = CurrentPalette;

            Vector2 drawscale = CurrentScale;

            if (this is Character)
            {
                drawscale *= (this as Character).DrawScale;
            }

            Video.DrawState drawstate = SpriteManager.SetupDrawing(currentelement.SpriteId, drawlocation, drawoffset, drawscale, GetDrawFlip());

            drawstate.Blending = Transparency == new Blending() ? currentelement.Blending : Transparency;
            drawstate.Rotation = (AngleDraw == true) ? Misc.FaceScalar(CurrentFacing, -DrawingAngle) : 0;

            PaletteFx.SetShader(drawstate.ShaderParameters);

            drawstate.Use();
        }
Example #16
0
        void DrawGrid()
        {
            Elements.StaticImage cellbg = m_elements.GetElement("cell.bg") as Elements.StaticImage;
            if (cellbg != null)
            {
                Drawing.Sprite sprite = cellbg.SpriteManager.GetSprite(cellbg.DataMap.SpriteId);
                if (sprite != null)
                {
                    Video.DrawState drawstate = cellbg.SpriteManager.DrawState;
                    drawstate.Reset();
                    drawstate.Set(sprite);

                    for (Int32 y = 0; y != m_gridsize.Y; ++y)
                    {
                        for (Int32 x = 0; x != m_gridsize.X; ++x)
                        {
                            Point location = m_gridposition;
                            location.X += (m_cellsize.X + m_cellspacing) * x;
                            location.Y += (m_cellsize.Y + m_cellspacing) * y;

                            PlayerSelect selection = GetSelection(new Point(x, y), false);
                            if (selection == null && m_showemptyboxes == false)
                            {
                                continue;
                            }

                            drawstate.AddData((Vector2)location, null);
                        }
                    }

                    drawstate.Use();
                }
            }

            for (Int32 y = 0; y != m_gridsize.Y; ++y)
            {
                for (Int32 x = 0; x != m_gridsize.X; ++x)
                {
                    Point xy = new Point(x, y);

                    Vector2 location = (Vector2)m_gridposition;
                    location.X += (m_cellsize.X + m_cellspacing) * x;
                    location.Y += (m_cellsize.Y + m_cellspacing) * y;

                    PlayerSelect selection = GetSelection(xy, false);
                    if (selection != null && selection.SelectionType == PlayerSelectType.Profile)
                    {
                        selection.Profile.SpriteManager.Draw(SpriteId.SmallPortrait, location, Vector2.Zero, Vector2.One, SpriteEffects.None);
                    }

                    if (selection != null && selection.SelectionType == PlayerSelectType.Random)
                    {
                        Elements.StaticImage randomimage = m_elements.GetElement("cell.random") as Elements.StaticImage;
                        if (randomimage != null)
                        {
                            randomimage.Draw(location);
                        }
                    }

                    if (m_p1info.CurrentCell == xy && m_p2info.CurrentCell == xy)
                    {
                        if (m_blinkval > 0)
                        {
                            m_p1info.DrawCursorActive(location);
                        }
                        else
                        {
                            m_p2info.DrawCursorActive(location);
                        }
                    }
                    else if (m_p1info.CurrentCell == xy)
                    {
                        m_p1info.DrawCursorActive(location);
                    }
                    else if (m_p2info.CurrentCell == xy)
                    {
                        m_p2info.DrawCursorActive(location);
                    }
                }
            }
        }