Пример #1
0
        /// <summary>
        /// Render some text directly to the spritebatch.
        /// </summary>
        /// <param name="sb">The spritebatch to draw with.</param>
        /// <param name="str">The string.</param>
        /// <param name="pos">The top-left position to draw the text at.</param>
        /// <param name="color">The color to draw the text with.</param>
        public void Render(CustomSpriteBatch sb, string str, Vector2 pos, Color color)
        {
            //TODO: Word wrapping

            int curX = 0;
            int curY = 0;

            foreach (char c in str)
            {
                var fc      = m_font.Chars.Find(f => f.ID == c);
                var texture = m_pages[fc.Page];

                var rectSource = new Rectangle(fc.X, fc.Y, fc.Width, fc.Height);
                var rectDest   = new RotRect(pos.X + curX + fc.XOffset, pos.Y + curY + fc.YOffset, fc.Width, fc.Height);

                sb.Draw(texture, rectSource, rectDest, color, false, false, false);

                curX += fc.XAdvance + ExtraKerning;
            }
        }
Пример #2
0
 public Note(int x, int y, int width, int height)
 {
     _bounds = new RotRect(x, y, width, height);
 }
Пример #3
0
 public Entity(uint id, RectangleF r, uint sortOrder)
 {
     Id        = id;
     Bounds    = new RotRect(r.X, r.Y, r.Width, r.Height);
     SortOrder = sortOrder;
 }