Ejemplo n.º 1
0
 private void internalClearContext(Microsoft.Xna.Framework.Color c, bool depthBufferBit, bool colorBufferBit)
 {
     if (depthBufferBit && colorBufferBit)
     {
         _graphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, c, _graphicsDevice.Viewport.MaxDepth, 0);
     }
     else if (depthBufferBit)
     {
         _graphicsDevice.Clear(ClearOptions.DepthBuffer, c, _graphicsDevice.Viewport.MaxDepth, 0);
     }
     else if (colorBufferBit)
     {
         _graphicsDevice.Clear(ClearOptions.Target, c, _graphicsDevice.Viewport.MaxDepth, 0);
     }
     else
     {
         _graphicsDevice.Clear(c);
     }
 }
Ejemplo n.º 2
0
 public void setColor(Color c)
 {
     _color = ((MonoGameColor)c).toMonoGameColor();
 }
Ejemplo n.º 3
0
        internal void draw(SpriteBatch spriteBatch, string str, float targetWidth, int horizontalAlignment, bool wrap, Vector2 position, Vector2 scale, Microsoft.Xna.Framework.Color renderColor)
        {
            var strings = wrapText(str, targetWidth + 1).Split('\n');
            var origin  = Vector2.Zero;

            if ((horizontalAlignment & Align.RIGHT) != 0)
            {
                origin.X    = _spriteFont.MeasureString(strings[0]).X;
                position.X += targetWidth;
            }
            else if ((horizontalAlignment & Align.CENTER) != 0)
            {
                origin.X    = (int)(_spriteFont.MeasureString(strings[0]).X / 2);
                position.X += (int)(targetWidth / 2);
            }
            spriteBatch.DrawString(_spriteFont,
                                   strings[0],
                                   position * scale,
                                   renderColor,
                                   0,
                                   origin,
                                   scale,
                                   SpriteEffects.None,
                                   0f);

            if (wrap)
            {
                for (var i = 1; i < strings.Length; i++)
                {
                    if ((horizontalAlignment & Align.RIGHT) != 0)
                    {
                        origin.X = _spriteFont.MeasureString(strings[i]).X;
                    }
                    else if ((horizontalAlignment & Align.CENTER) != 0)
                    {
                        origin.X = (int)(_spriteFont.MeasureString(strings[i]).X / 2);
                    }
                    position.Y += getLineHeight();
                    spriteBatch.DrawString(_spriteFont,
                                           strings[i],
                                           position * scale,
                                           renderColor,
                                           0,
                                           origin,
                                           scale,
                                           SpriteEffects.None,
                                           0f);
                }
            }
        }
Ejemplo n.º 4
0
 public void setBackgroundColor(Color backgroundColor)
 {
     _backgroundColor = ((MonoGameColor)backgroundColor).toMonoGameColor();
 }
Ejemplo n.º 5
0
 public void setColor(Color color)
 {
     _setColor = ((MonoGameColor)color).toMonoGameColor();
 }
Ejemplo n.º 6
0
 public void setColor(Color color)
 {
     _setColor = ((MonoGameColor)color)._color;
 }
Ejemplo n.º 7
0
 internal void clearGraphicsDevice(Microsoft.Xna.Framework.Color color)
 {
     _graphicsDevice.Clear(color);
 }
Ejemplo n.º 8
0
 public void setColor(Color c)
 {
     _color = ((MonoGameColor)c)._color;
 }