Exemple #1
0
        internal override void Draw(Microsoft.Xna.Framework.GameTime gameTime)
        {
            base.Draw(gameTime);

            MainGame.DefaultFont.Spacing = 0.8f;

            if (curTexture != null)
            {
                float unscaledOffset = (MainGame.OriginalAppHeight - curTexture.Height) / 2;

                int yPos = MainGame.ScaledOffsetY + (int)(unscaledOffset * MainGame.ScaleY); // Centered Position
                if (useVoiceOver == false)
                {
                    yPos = 5;
                }

                Rectangle rect = new Rectangle(MainGame.ScaledOffsetX, yPos,
                                               (int)(curTexture.Width * MainGame.ScaleX), (int)(curTexture.Height * MainGame.ScaleY));

                MainGame.SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone);
                MainGame.SpriteBatch.Draw(curTexture, rect, Color.FromNonPremultiplied(new Vector4(Vector3.One, storyboard.CurrentAlpha)));
                MainGame.SpriteBatch.End();

                if (useVoiceOver == false)
                {
                    int yStart = 147;

                    string introText = storyboard.GetCurrentIntroText();
                    FontRenderer.DrawStringDirect(MainGame.DefaultFont, introText, 0, yStart, MainGame.OriginalAppWidth, MainGame.OriginalAppHeight - yStart, Color.White);
                }
            }
        }
Exemple #2
0
        protected override void Draw()
        {
            base.Draw();

            Vector2 screenPos = ScreenPosition;

            Color col = Color.FromNonPremultiplied(new Vector4(Vector3.One, CompositeAlpha));

            Vector2 fullSize  = (Font != null ? (Vector2)Font.MeasureString(Text) : Vector2.Zero);
            float   textScale = 1.0f;

            if (AutoScaleFont)
            {
                textScale = this.Width / fullSize.X;
            }
            fullSize *= textScale;

            Vector2 position = new Vector2(0, screenPos.Y - 3);

            switch (TextAlignHorizontal)
            {
            case UITextAlignHorizontal.Center:
                position.X = screenPos.X + (Width / 2.0f - fullSize.X / 2.0f);
                break;

            case UITextAlignHorizontal.Left:
                position.X = screenPos.X;
                break;

            case UITextAlignHorizontal.Right:
                position.X = screenPos.X + (Width - fullSize.X);
                break;
            }

            switch (TextAlignVertical)
            {
            case UITextAlignVertical.Top:
                position.Y = screenPos.Y;
                break;

            case UITextAlignVertical.Center:
                position.Y = screenPos.Y + (Height / 2.0f - fullSize.Y / 2.0f);
                break;

            case UITextAlignVertical.Bottom:
                position.Y = screenPos.Y + Height - fullSize.Y;
                break;
            }

            FontRenderer.DrawStringDirect(renderConfig, Font, Text, position.X, position.Y, col, textScale, CompositeRotation);

            //
        }
Exemple #3
0
        protected override void Draw()
        {
            base.Draw();

            string textToDisplay = Text;
            Color  textColor     = Color.FromNonPremultiplied(new Vector4(Vector3.One, CompositeAlpha));

            if (string.IsNullOrWhiteSpace(textToDisplay))
            {
                textColor     = Color.FromNonPremultiplied(new Vector4(new Vector3(0.5f), CompositeAlpha));
                textToDisplay = ShadowText;
            }

            Vector2    screenPos = ScreenPosition;
            RectangleF rect      = new RectangleF(screenPos.X, screenPos.Y, Width, Height);

            Color borderColor = Color.FromNonPremultiplied(new Vector4(BorderColor.ToVector3(), CompositeAlpha));

            Graphics2D.Texture.RenderRectangle(renderConfig, rect, borderColor, BorderWidth);

            Vector2 fullSize = (Font != null ? (Vector2)Font.MeasureString(textToDisplay) : Vector2.Zero);

            // Draw Text (either normal or shadow text)
            Vector2 position = new Vector2(0, screenPos.Y - 3);

            position.X = screenPos.X + Padding;
            position.Y = screenPos.Y + (Height / 2.0f - fullSize.Y / 2.0f);
            FontRenderer.DrawStringDirect(renderConfig, Font, textToDisplay, position.X, position.Y, textColor, 1.0f, CompositeRotation);

            // Draw cursor at location of Text
            if (HasCapturedKeyboardFocus() &&
                renderCursor)
            {
                float cursorLocation = 0.0f;
                if (Text != null)
                {
                    string  textSubstring       = Text.Substring(0, cursorPos);
                    Vector2 textSubstringLength = (Font != null ? (Vector2)Font.MeasureString(textSubstring) : Vector2.Zero);
                    cursorLocation = textSubstringLength.X;
                }
                RectangleF cursorRect = new RectangleF(position.X + cursorLocation, position.Y, 2, fullSize.Y);
                Graphics2D.Texture.FillRectangle(renderConfig, cursorRect, Color.White);
            }
        }
Exemple #4
0
        internal override void Draw(GameTime gameTime)
        {
            UIWindowManager.Render();

            FontRenderer.DrawStringDirect(MainGame.DefaultFont, "Version: " + MainGame.Version, 270, 194, Color.White, 0.5f);
        }