示例#1
0
 public override void Draw(GameTime time, SpriteBatch batch)
 {
     batch.Draw (texMap, OpenTK.Vector2.Zero, Color4.White);
     batch.Draw (texOverlay, OpenTK.Vector2.Zero, new Color4 (1, 1, 1, overlayAlpha));
     batch.Draw (texMenu, OpenTK.Vector2.Zero, new Color4 (1, 1, 1, menuAlpha));
     base.Draw (time, batch);
 }
示例#2
0
 public override void Draw(GameTime time, SpriteBatch batch)
 {
     var tint = new Color4 (1 - (blueTint * 3f), 1f - (blueTint * 2f), 1f - blueTint, 1);
     batch.Draw (texMap, new Vector2 (backgroundLeft, 0), tint);
     if (backgroundLeft < 640)
         batch.Draw (texMap, new Vector2 (backgroundLeft + texMap.Width, 0), tint);
     bird.Draw (time, batch);
     generator.Draw (time, batch);
     base.Draw (time, batch);
 }
示例#3
0
 public void Draw(GameTime time, SpriteBatch batch)
 {
     tubes.ForEach (instance => {
         if (instance.IsInView ()) {
             for (var i = 0; i < instance.Tubes.Length; i++) {
                 batch.Draw (instance.Tubes [i].Texture, instance.Tubes [i].Position, Color4.White);
             }
         }
     });
 }
示例#4
0
 public void Draw(SpriteBatch batch, Vector2 position)
 {
     for (int y = 0; y < Height; y++)
         for (int x = 0; x < Width; x++) {
             var tile = Layers[x + y * Width];
             if (tile.TileId != -1) {
                 var xPos = x * Sheet.TileWidth * Scale;
                 var yPos = y * Sheet.TileHeight * Scale;
                 batch.Draw (Sheet.Texture, Sheet[tile.TileId], position + new Vector2 (xPos, yPos), Color4.White, scale: Scale, rotation: tile.Rotation);
             }
         }
 }
示例#5
0
 /// <summary>
 /// Draw.
 /// </summary>
 /// <param name="time">Time.</param>
 /// <param name="batch">Batch.</param>
 public void Draw(GameTime time, SpriteBatch batch)
 {
     // Draw the tile
     batch.Draw (
         texture: Sheet.Texture,
         sourceRect: Sheet [StartTile + Index],
         position: Position,
         origin: new Vector2 (Sheet [StartTile + Index].Width / 2f, Sheet [StartTile + Index].Height / 2f),
         color: Tint,
         scale: Scale,
         rotation: RotationX
     );
 }
示例#6
0
 public void Draw(GameTime time, SpriteBatch batch)
 {
     batch.Draw (MascotTexture, Position, Color4.White, 1, rotation: MathHelper.DegreesToRadians (90));
 }
示例#7
0
 public override void Draw(GameTime time, SpriteBatch batch)
 {
     if (UseTexture && BackgroundTexture != null)
         batch.Draw (BackgroundTexture, BackgroundTexture.Bounds, Bounds, new Color4 (1, 1, 1, Transparency));
     base.Draw (time, batch);
 }
示例#8
0
 public override void Draw(GameTime time, SpriteBatch batch)
 {
     if (Background != null)
         batch.Draw (Background, source, dest, Color4.White);
     base.Draw (time, batch);
 }
示例#9
0
 /// <summary>
 /// Draw a string.
 /// </summary>
 /// <param name="spriteBatch">Sprite batch.</param>
 /// <param name="text">Text.</param>
 /// <param name="x">The x coordinate.</param>
 /// <param name="y">The y coordinate.</param>
 /// <param name="color">Color.</param>
 public void DrawString(SpriteBatch spriteBatch, string text, int x, int y, Color4 color)
 {
     if (text == "") //Skip empty strings
         return;
     var iter = new CodepointIterator (text);
     float penX = x, penY = y;
     while (iter.Iterate ()) {
         uint c = iter.Codepoint;
         if (c == (uint) '\n') {
             penY += lineHeight;
             penX = x;
             continue;
         }
         var glyph = GetGlyph (c);
         if (glyph.Render) {
             spriteBatch.Draw (
                 glyph.Texture,
                 glyph.Rectangle,
                 new Rectangle (
                     (int) penX + glyph.XOffset,
                     (int) penY + (LineHeight - glyph.YOffset),
                     glyph.Rectangle.Width,
                     glyph.Rectangle.Height
                 ),
                 color
             );
             penX += glyph.HorizontalAdvance;
             penY += glyph.AdvanceY;
         } else {
             penX += glyph.AdvanceX;
             penY += glyph.AdvanceY;
         }
         if (iter.Index < iter.Count - 1) {
             var g2 = GetGlyph (iter.PeekNext ());
             FT.FT_Vector vec;
             FT.FT_Get_Kerning (facePtr, glyph.CharIndex, g2.CharIndex, 2, out vec);
             var krn = FTMath.From26Dot6 (vec.x);
             penX += krn;
         }
     }
 }