Ejemplo n.º 1
0
        static ThemeManager()
        {
            // Sets up the default theme
            theme = new Theme();
            theme.Read(Assets.GetAssetFile("themes/default/theme.xml"));

            // Set up the events
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Figures out the line heights once and stores them.
        /// </summary>
        private void CalculateLineHeights(Theme theme)
        {
            // Get the fonts
            ThemeFont h1 = theme.Fonts["h1"];
            ThemeFont h2 = theme.Fonts["h2"];
            ThemeFont h3 = theme.Fonts["h3"];
            ThemeFont p = theme.Fonts["p"];

            // Go through the lines
            float total = 0;

            foreach (TextScrollLine tsl in lines)
            {
                // Keep track of the current line's height
                ThemeFont current = p;

                switch (tsl.LineType)
                {
                    case LineType.Heading1: current = h1; break;
                    case LineType.Heading2: current = h2; break;
                    case LineType.Heading3: current = h3; break;
                }

                // Set the line
                tsl.Font = current;
                tsl.Height =
                    ((BooGame.Video.FreeTypeFont) current.Font).LineHeight;

                total += tsl.Height;
                tsl.Position = total;
            }

            // We are done calculating
            hasCalculatedLineHeights = true;
        }