Example #1
0
        private void RenderConsumableInfo(SpriteBatch spriteBatch, string iconName, float iconScale, int totalUnits, float centerX)
        {
            string  text     = Translator.Translation("unit-count").Replace("[QUANTITY]", totalUnits.ToString());
            float   width    = (TextureManager.Textures[iconName].Width * iconScale) + TextWriter.Dimensions(text).X;
            Vector2 position = new Vector2(centerX - (width / 2.0f), WorldPosition.Y + Top_Margin);

            spriteBatch.Draw(TextureManager.Textures[iconName], GameBase.ScreenPosition(position), null, Color.White, 0.0f, Vector2.Zero,
                             GameBase.ScreenScale(iconScale), SpriteEffects.None, Render_Depth);

            TextWriter.Write(text, spriteBatch, position + new Vector2(TextureManager.Textures[iconName].Width * iconScale, 0.0f), Color.White,
                             Color.Black, Outline_Thickness, Text_Scale, Render_Depth, TextWriter.Alignment.Left);
        }