Esempio n. 1
0
 public void Draw(FloatPoint center, Vector2 size)
 {
     Sb.Draw(Texture,
             destinationRectangle: new Rectangle((int)center.X, (int)center.Y, (int)size.X, (int)size.Y),
             sourceRectangle: new Rectangle(0, 0, (int)SizeX, (int)SizeY),
             color: Color.White,
             rotation: (MathHelper.PiOver2 / 3.0f) + (MathHelper.PiOver2 / 1.5f) * Rotation,
             origin: new Vector2(size.X / 2, size.Y / 2)
             );
 }
Esempio n. 2
0
        public void Draw(Texture2D texture)
        {
            var v2 = Vector2.Transform(StartV, Matrix.Invert(Camera.Transform));

            Sb.Draw(
                texture,
                destinationRectangle: new Rectangle((int)v2.X, (int)v2.Y, (int)Size.X, (int)Size.Y),
                sourceRectangle: new Rectangle(0, 0, 100, 100),
                color: Color.White
                // origin: new Vector2(Size.X / 2, Size.Y / 2)
                );
        }
Esempio n. 3
0
        public void Draw()
        {
            //https://www.codeproject.com/Articles/1119973/Part-I-Creating-a-Digital-Hexagonal-Tile-Map
            //public void Draw(Texture2D texture, Vector2 position, Rectangle? sourceRectangle, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth);
            var effect = SpriteEffects.None;

            //:TODO list of flippables
            //if you want weird effects that animate way too fast
            //if (RandomEffectSet == false &&  Name == "boulder")
            //{
            //    Effect = (SpriteEffects)new Random().Next(3);
            //    RandomEffectSet = true;
            //}
            Sb.Draw(texture: Texture,
                    destinationRectangle: new Rectangle((int)Center.X, (int)Center.Y, (int)SizeX * 2, (int)SizeY * 2),
                    //this is inconsistent -> maybe not anymore
                    sourceRectangle: new Rectangle(ResizeLeft, 0, ResizeRight, (int)SizeY),
                    color: Color,
                    origin: new Vector2(SizeX / 2, SizeY / 2)
                    //scale: new Vector2(9000,0.5f),
                    //effects: Effect
                    //layerDepth: 0.0f
                    );
            if (Highlighted)
            {
                Sb.Draw(texture: HighlightedTexture,
                        destinationRectangle: new Rectangle((int)Center.X, (int)Center.Y, (int)SizeX * 2, (int)SizeY * 2),
                        //this is inconsistent -> maybe not anymore
                        sourceRectangle: new Rectangle(ResizeLeft, 0, ResizeRight, (int)SizeY),
                        color: Color,
                        origin: new Vector2(SizeX / 2, SizeY / 2)
                        //scale: new Vector2(9000,0.5f),
                        //effects: SpriteEffects.None,
                        //layerDepth: 0.0f
                        );
            }
            foreach (Line line in Edges)
            {
                //if (Hovered)
                //{
                //    line.Draw(Color.Yellow);
                //}
                //else
                //{
                //    line.Draw(Color.Black);
                //}
                line.Draw();
            }
        }
Esempio n. 4
0
 //maybe also a draw that just takes the R/Q cords?
 public void Draw(Vector2 center)
 {
     //special draw for factions :TODO
     if (Controllable)
     {
         Sb.DrawString(Font, "A", center - new Vector2(50, 50), Color.Black);
     }
     Sb.Draw(Texture,
             destinationRectangle: new Rectangle((int)center.X, (int)center.Y, (int)SizeX, (int)SizeY),
             sourceRectangle: new Rectangle(0, 0, (int)SizeX, (int)SizeY),
             color: Color.White,
             rotation: (MathHelper.PiOver2 / 3.0f) + (MathHelper.PiOver2 / 1.5f) * Rotation,
             origin: new Vector2(SizeX / 2, SizeY / 2)
             );
 }
Esempio n. 5
0
        //https://gamedev.stackexchange.com/questions/44015/how-can-i-draw-a-simple-2d-line-in-xna-without-using-3d-primitives-and-shders
        //https://gamedev.stackexchange.com/questions/26013/drawing-a-texture-line-between-two-vectors-in-xna-wp7
        public void Draw()
        {
            Vector2 edge  = EndV - StartV;
            float   angle = (float)Math.Atan2(edge.Y, edge.X);

            //float drawPosZ = Color.Yellow == lineColor ? 0f : 0.01f;

            Sb.Draw(Texture,
                    StartV,
                    null,
                    LineColor,
                    (float)Math.Atan2(EndV.Y - StartV.Y, EndV.X - StartV.X),
                    new Vector2(0f, (float)Texture.Height / 2),
                    new Vector2(Vector2.Distance(StartV, EndV), WidthMultiplier), //float for width
                    SpriteEffects.None,
                    0f
                    );
        }