示例#1
0
文件: BaseC.cs 项目: temik911/audio
        internal override void Draw(SpriteBatch sb, Fusion.Graphics.DebugStrings ds, StereoEye stereoEye)
        {
            float offsetScale = 0;
            if (stereoEye == StereoEye.Left)
                offsetScale = -Config.offsetScale;
            if (stereoEye == StereoEye.Right)
                offsetScale = Config.offsetScale;

            sb.Draw(Texture, Cell.X - offsetScale, Cell.Y, Config.HEX_SIZE, Config.HEX_SIZE, ((Team)Parent).Color);
        }
示例#2
0
        public MapLayer(Game game, LayerServiceConfig config)
            : base(game, config)
        {
            Transform = Matrix.Transformation(Vector3.Zero, Quaternion.Identity, Vector3.One, Vector3.Zero, Quaternion.Identity, Vector3.Zero);

            sb = Game.GetService<SpriteBatch>();

            RegisterMapSources();
            CurrentMapSource = MapSources[0];

            //Game.InputDevice.MouseMove += InputDeviceOnMouseMove;

            InitShaderAndBuffer();
        }
示例#3
0
        internal override void Draw(Fusion.Graphics.SpriteBatch sb, Fusion.Graphics.DebugStrings ds, StereoEye stereoEye)
        {
            float offsetScale = 0;

            if (stereoEye == StereoEye.Left)
            {
                offsetScale = -Config.offsetScale;
            }
            if (stereoEye == StereoEye.Right)
            {
                offsetScale = Config.offsetScale;
            }
            sb.Draw(Texture, Cell.X - offsetScale, Cell.Y, Config.HEX_SIZE, Config.HEX_SIZE, new Color(255, 255, 128, 255));
        }
示例#4
0
        internal override void Draw(Fusion.Graphics.SpriteBatch sb, Fusion.Graphics.DebugStrings ds, StereoEye stereoEye)
        {
            float offsetScale = 0;

            if (stereoEye == StereoEye.Left)
            {
                offsetScale = -Config.offsetScale;
            }
            if (stereoEye == StereoEye.Right)
            {
                offsetScale = Config.offsetScale;
            }
            if (Cell.Type == CellType.SHALLOW)
            {
                offsetScale = 0;
            }
            sb.Draw(Texture, Cell.X + offsetScale, Cell.Y, Config.HEX_SIZE, Config.HEX_SIZE, color);
        }
示例#5
0
        internal override void Draw(Fusion.Graphics.SpriteBatch sb, Fusion.Graphics.DebugStrings ds, StereoEye stereoEye)
        {
            float currentX = X + Config.OffsetX;
            float currentY = Y + Config.OffsetY;

            float offsetScale = 0;

            if (stereoEye == StereoEye.Left)
            {
                offsetScale = -Config.offsetScale;
            }
            if (stereoEye == StereoEye.Right)
            {
                offsetScale = Config.offsetScale;
            }

            var color = new Color(255, 255, 128, 255);

            foreach (Cell cell in pathList)
            {
                sb.Draw(path, cell.X - offsetScale, cell.Y, Config.HEX_SIZE, Config.HEX_SIZE, color);
            }
            sb.Draw(Texture, currentX - offsetScale, currentY, Config.HEX_SIZE, Config.HEX_SIZE, color);
        }
示例#6
0
文件: Entity.cs 项目: temik911/audio
 internal override void Draw(SpriteBatch sb, DebugStrings ds, int order, StereoEye stereoEye)
 {
     if (order == _order)
         Draw(sb, ds, stereoEye);
 }
示例#7
0
文件: Entity.cs 项目: temik911/audio
 internal override void Draw(SpriteBatch sb, DebugStrings ds, StereoEye stereoEye)
 {
 }
示例#8
0
文件: Marker.cs 项目: temik911/audio
 internal override void Draw(SpriteBatch sb, DebugStrings ds, StereoEye stereoEye)
 {
     sb.Draw(Texture, Cell.X - 1.4f, Cell.Y - 1.4f, Config.HEX_SIZE + 2.8f, Config.HEX_SIZE + 2.8f, Color.White);
 }
示例#9
0
        internal override void Draw(SpriteBatch sb, DebugStrings ds, StereoEye stereoEye)
        {
            float currentX = X + Config.OffsetX;
            float currentY = Y + Config.OffsetY;

            float offsetScale = 0;
            if (stereoEye == StereoEye.Left)
                offsetScale = -Config.offsetScale;
            if (stereoEye == StereoEye.Right)
                offsetScale = Config.offsetScale;

            sb.Draw(Texture, currentX - offsetScale, currentY, Config.HEX_SIZE, Config.HEX_SIZE, ((Team)Parent).Color);
            float x = ((Team)Parent).TeamId % 2 == 0 ? currentX + 230 * Config.HEX_SIZE / 1000 : currentX + 50 * Config.HEX_SIZE / 1000;
            float y = currentY + 380 * Config.HEX_SIZE / 1000;
            int starSize = Config.HEX_SIZE / 3;
            for (int i = 0; i < _healths; i++)
            {
                sb.Draw(_health, x - offsetScale, y + Config.HEX_SIZE / 3, starSize, starSize, ((Team)Parent).Color);
                x += starSize * 55 / 100 + 1;
            }
        }
示例#10
0
        /*Color EscColor ( char ch ) {
            if (ch=='0') return Color.White;
            if (ch=='1') return Color.Red;
            if (ch=='2') return Color.Orange;
            if (ch=='3') return Color.Yellow;
            if (ch=='4') return Color.Green;
            if (ch=='5') return Color.Cyan;
            if (ch=='6') return Color.Blue;
            if (ch=='7') return Color.Magenta;
            if (ch=='8') return Color.Black;
            if (ch=='9') return Color.Gray;
            return Color.White;
        } */
        /// <summary>
        /// Draws the string
        /// </summary>
        /// <param name="sb"></param>
        /// <param name="text"></param>
        /// <param name="xPos"></param>
        /// <param name="yPos"></param>
        /// <param name="color"></param>
        public void DrawString( SpriteBatch spriteBatch, string text, float xPos, float yPos, Color color, float tracking = 0, bool bl = true, bool flip = false )
        {
            if (text==null) {
                return;
            }

            float x, y;

            if (!flip) {
                x = xPos;
                y = yPos;// - fontInfo.baseLine;
                if (bl) {
                    y -= fontInfo.baseLine;
                }
            } else {
                x = yPos;
                y = xPos;// - fontInfo.baseLine;
                if (bl) {
                    x -= fontInfo.baseLine;
                }
            }

            int length = text.Length;

            float w	=	fontTexture.Width;
            float h	=	fontTexture.Height;

            for (int i=0; i<length; i++) {

                char ch0	= text[i];

                if (ch0 == '\n') {
                    y += fontInfo.lineHeight;
                    x =  xPos;
                }

                char ch1	= (i+1)<length ? text[i+1] : '\0';
                var chi		= GetInfo(ch0);
                var kerning = GetKerning( ch0, ch1 );

                /*if (ch0=='^' && char.IsDigit(ch1)) {
                    i++;
                    color = EscColor(ch1);
                    continue;
                } */

                RectangleF	dstRect = chi.dstRect;
                RectangleF	srcRect = chi.srcRect;

                dstRect.X	+= x;
                dstRect.Y	+= y;
                /*dstRect.Right	+= x;
                dstRect.Bottom  += y;*/
                if (!flip) {
                    x += chi.xAdvance;
                    x += kerning;
                    x += tracking;
                } else {
                    x -= chi.xAdvance;
                    x -= kerning;
                    x -= tracking;
                }

                //spriteBatch.Draw( fontTexture, dstRect, srcRect, color );
                var c = color * spriteBatch.ColorMultiplier;

                if (!flip) {
                    var v0	=	new SpriteVertex( new Vector3(dstRect.X,                 dstRect.Y                 , 0), c, new Vector2((srcRect.X                ) / w, (srcRect.Y                 ) / h) );
                    var v1	=	new SpriteVertex( new Vector3(dstRect.X + dstRect.Width, dstRect.Y                 , 0), c, new Vector2((srcRect.X + srcRect.Width) / w, (srcRect.Y                 ) / h) );
                    var v2	=	new SpriteVertex( new Vector3(dstRect.X + dstRect.Width, dstRect.Y + dstRect.Height, 0), c, new Vector2((srcRect.X + srcRect.Width) / w, (srcRect.Y + srcRect.Height) / h) );
                    var v3	=	new SpriteVertex( new Vector3(dstRect.X,                 dstRect.Y + dstRect.Height, 0), c, new Vector2((srcRect.X                ) / w, (srcRect.Y + srcRect.Height) / h) );
                    spriteBatch.DrawQuad( fontTexture, v0, v1, v2, v3 );
                } else {
                    var v0	=	new SpriteVertex( new Vector3(dstRect.Y                 , dstRect.X                , 0), c, new Vector2((srcRect.X                ) / w, (srcRect.Y                 ) / h) );
                    var v1	=	new SpriteVertex( new Vector3(dstRect.Y                 , dstRect.X - dstRect.Width, 0), c, new Vector2((srcRect.X + srcRect.Width) / w, (srcRect.Y                 ) / h) );
                    var v2	=	new SpriteVertex( new Vector3(dstRect.Y + dstRect.Height, dstRect.X - dstRect.Width, 0), c, new Vector2((srcRect.X + srcRect.Width) / w, (srcRect.Y + srcRect.Height) / h) );
                    var v3	=	new SpriteVertex( new Vector3(dstRect.Y + dstRect.Height, dstRect.X                , 0), c, new Vector2((srcRect.X                ) / w, (srcRect.Y + srcRect.Height) / h) );
                    spriteBatch.DrawQuad( fontTexture, v0, v1, v2, v3 );
                }

            }
        }
示例#11
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="spriteBatch"></param>
 /// <param name="glyphs"></param>
 /// <param name="offsetX"></param>
 /// <param name="offsetY"></param>
 public static void DrawGlyphs( SpriteBatch spriteBatch, IEnumerable<Glyph> glyphs, int offsetX, int offsetY )
 {
     foreach ( var glyph in glyphs ) {
         spriteBatch.Draw( glyph.Texture, glyph.DstRect, glyph.SrcRect, offsetX, offsetY, glyph.Color );
     }
 }
示例#12
0
文件: Team.cs 项目: temik911/audio
        internal override void Draw(SpriteBatch sb, DebugStrings ds, int order, StereoEye stereoEye)
        {
            base.Draw(sb, ds, order, stereoEye);

            int k = 0;
            if (Config.HEX_SIZE < 24) k = 1;

            int j = 1;
            if (Config.HEX_SIZE < 24) j = 0;

            int pinY = ((int)Field.Field[Config.FIELD_HEIGHT - 1, Config.FIELD_WIDTH - 1].Y + Config.HEX_SIZE * 11 / 8) + TeamId * k * Config.HEX_SIZE;
            int pinX = (int)Field.Field[0, 0].X + TeamId * j * (int)Field.Field[0, (Config.FIELD_WIDTH - 1) / 2].X;
            object[] o = new object[Submarines.Count * 4];
            int i = 0;
            String str = "";
            foreach (Submarine sub in Submarines)
            {
                o[i] = Config.Names[sub.Number];
                str += "{" + i++ + "} - ";
                o[i] = sub.Health;
                str += "{" + i++ + "}/";
                o[i] = sub.TorpedoCount;
                str += "{" + i++ + "}/";
                o[i] = sub.MinesCount;
                str += "{" + i++ + "}   ";
            }
            sb.DrawDebugString(pinX, pinY, string.Format(str, o), Color);
        }
示例#13
0
 internal abstract void Draw(SpriteBatch sb, DebugStrings ds, StereoEye stereoEye);