コード例 #1
0
 public override void Draw(DrawContext context)
 {
     // To render the scrolled panel, we just adjust our offset before rendering our child controls as
     // a normal PanelControl
     context.DrawOffset.Y = -scrollTracker.ViewRect.Y;
     base.Draw(context);
 }
コード例 #2
0
ファイル: TextControl.cs プロジェクト: rise-worlds/RiseWorlds
        public override void Draw(DrawContext context)
        {
            base.Draw(context);

            context.SpriteBatch.DrawString(font, Text, context.DrawOffset, Color);
        }
コード例 #3
0
        public override void Draw(DrawContext context)
        {
            base.Draw(context);
            Texture2D drawTexture = texture ?? context.BlankTexture;

            Vector2 actualSourceSize = SourceSize ?? Size;
            Rectangle sourceRectangle = new Rectangle
            {
                X = (int)origin.X,
                Y = (int)origin.Y,
                Width = (int)actualSourceSize.X,
                Height = (int)actualSourceSize.Y,
            };
            Rectangle destRectangle = new Rectangle
            {
                X = (int)context.DrawOffset.X,
                Y = (int)context.DrawOffset.Y,
                Width = (int)Size.X,
                Height = (int)Size.Y
            };
            context.SpriteBatch.Draw(drawTexture, destRectangle, sourceRectangle, Color);
        }
コード例 #4
0
ファイル: Control.cs プロジェクト: rise-worlds/RiseWorlds
 /// <summary>
 /// 
 /// </summary>
 /// <param name="context"></param>
 public virtual void Draw(DrawContext context)
 {
     Vector2 origin = context.DrawOffset;
     for(int i=0; i<ChildCount; i++)
     {
         Control child = children[i];
         if (child.Visible)
         {
             context.DrawOffset = origin + child.Position;
             child.Draw(context);
         }
     }
 }