示例#1
0
        public void DrawImage(IImage image, int x, int y, int width, int height)
        {
            XnaContextSettings xnaContextSettings = CurrentSettings();
            var xnaImage = (XnaImage)image;

            currentSpriteBatch.Draw(xnaImage.Texture, new Microsoft.Xna.Framework.Rectangle(xnaContextSettings.Left + x, xnaContextSettings.Top + y, width, height), xnaImage.SourceRectangle, WHITE, 0, Vector2.Zero, DrawingEffectsToSpriteEffects(xnaContextSettings.DrawingEffects), 1);
        }
示例#2
0
        public void Translate(int x, int y)
        {
            XnaContextSettings xnaContextSettings = CurrentSettings();

            xnaContextSettings.Left += x;
            xnaContextSettings.Top  += y;
        }
示例#3
0
        public void DrawImage(IImage image, int x, int y, double angle, int centerX, int centerY)
        {
            XnaContextSettings xnaContextSettings = CurrentSettings();
            var xnaImage = (XnaImage)image;


            Vector2 location = new Vector2(xnaContextSettings.Left + x + centerX, xnaContextSettings.Top + y + centerY);
            Vector2 origin   = new Vector2(centerX, centerY);

            currentSpriteBatch.Draw(xnaImage.Texture, location, xnaImage.SourceRectangle, WHITE, (float)angle, origin, 1.0f, DrawingEffectsToSpriteEffects(xnaContextSettings.DrawingEffects), 1);
        }
示例#4
0
        public void DrawString(string fontName, string text, int x, int y, Color color)
        {
            XnaContextSettings xnaContextSettings = CurrentSettings();
            var font = renderer.GetFont(fontName);

            if (font == null)
            {
                return;
            }

            currentSpriteBatch.DrawString(font, text, new Vector2(xnaContextSettings.Left + x, xnaContextSettings.Top + y),
                                          new Microsoft.Xna.Framework.Color(color.R, color.G, color.B, color.A), 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 1);
        }
示例#5
0
        public void DrawString(string fontName, string text, int x, int y)
        {
            XnaContextSettings xnaContextSettings = CurrentSettings();
            var font = renderer.GetFont(fontName);

            if (font == null)
            {
                return;
            }

            currentSpriteBatch.DrawString(font, text, new Vector2(xnaContextSettings.Left + x, xnaContextSettings.Top + y),
                                          WHITE, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 1);
        }
示例#6
0
        public void DrawRectangle(Color color, int x, int y, int width, int height)
        {
            XnaContextSettings xnaContextSettings = CurrentSettings();

            currentSpriteBatch.Draw(shapeCache.GetShape(color, width, height), new Vector2(xnaContextSettings.Left + x, xnaContextSettings.Top + y), WHITE);
        }
示例#7
0
        public void SetDrawingEffects(DrawingEffects drawingEffects)
        {
            XnaContextSettings xnaContextSettings = CurrentSettings();

            xnaContextSettings.DrawingEffects = drawingEffects;
        }