Esempio n. 1
0
        public void Draw(SpriteBatch spriteBatch)
        {
            float scaleInterpolation = 1.0f + 0.2f * _interpolation;
            Color color = Color.Lerp(StyleSheet.HighlightColor, StyleSheet.BackgroundColor, _interpolation);

            spriteBatch.DrawString(StyleSheet.DefaultFont,
                                   text: ActiveWord,
                                   position: VirtualCoords.ComputePixelPosition(CenterPosition),
                                   color: color,
                                   rotation: 0.0f,
                                   origin: StyleSheet.DefaultFont.MeasureString(ActiveWord) * 0.5f,
                                   scale: VirtualCoords.ComputePixelScale(StyleSheet.ScalingFontToWorld * _temporaryScaling * scaleInterpolation),
                                   effects: SpriteEffects.None,
                                   layerDepth: 0.0f);
        }
Esempio n. 2
0
        private void DrawRatingStars()
        {
            var rating = _activeLevel.CurrentSentenceRating;

            if (rating == 0)
            {
                const float ratingStarYOffset = 0.3f;
                const float ratingStarSize    = 0.1f;
                const float ratingStarSpacing = 0.02f;
                var         totalWidth        = ratingStarSize * rating + (rating - 1) * ratingStarSpacing;
                var         currentX          = (VirtualCoords.RELATIVE_MAX.X - totalWidth) * 0.5f;

                for (int i = 0; i < rating; ++i)
                {
                    currentX += ratingStarSize * 0.5f;
                    _spriteBatch.Draw(StyleSheet.StarTexture, destinationRectangle:
                                      VirtualCoords.ComputePixelRect_Centered(new Vector2(currentX, ratingStarYOffset),
                                                                              ratingStarSize),
                                      Color.LightYellow);
                    currentX += ratingStarSize * 0.5f + ratingStarSpacing;
                }
            }

            var text = rating switch
            {
                0 => "Are you sure? Try again!",
                1 => "Better than before, but not good enough!",
                2 => "Pretty good, on to the next level",
                3 => "Excellent",
                _ => ""
            };

            var centerPos = new Vector2(0.8f, 0.8f);

            _spriteBatch.DrawString(StyleSheet.DefaultFont,
                                    text: text,
                                    position: VirtualCoords.ComputePixelPosition(centerPos),
                                    color: Color.White,
                                    rotation: 0.0f,
                                    origin: StyleSheet.DefaultFont.MeasureString(text) * 0.5f,
                                    scale: VirtualCoords.ComputePixelScale(StyleSheet.ScalingFontToWorld),
                                    effects: SpriteEffects.None,
                                    layerDepth: 0.0f);
        }