Exemple #1
0
        public override void DrawCore(SpriteBatch spriteBatch, GuiRect finalRect)
        {
            base.DrawCore(spriteBatch, finalRect);
            Rectangle r = new Rectangle(
                Convert.ToInt32(finalRect.X),
                Convert.ToInt32(finalRect.Y),
                Convert.ToInt32(finalRect.Width),
                Convert.ToInt32(finalRect.Height));

            GuiPainter.DrawRectangle(spriteBatch, r, Color.White, fTexture);
        }
Exemple #2
0
        public override void LoadContent(GuiEngine engine)
        {
            fTexture = GuiPainter.GetTexture1x1(Device);

            base.LoadContent(engine);
            if (Childs != null)
            {
                foreach (var child in Childs)
                {
                    child.Header.LoadContent(engine);
                }
            }
        }
Exemple #3
0
        protected override void DoDraw(SpriteBatch spriteBatch, GuiPoint point, Rectangle clipRect)
        {
            Rectangle r = new Rectangle(
                point.X + Offset.X,
                point.Y + Offset.Y,
                RenderSize.Width,
                RenderSize.Height);

            if (BackgroundColor != Color.Transparent)
            {
                GuiPainter.DrawRectangle(spriteBatch, r, BackgroundColor, fTexture);
            }
            base.DoDraw(spriteBatch, point, clipRect);
        }
Exemple #4
0
        protected override void DoDraw(SpriteBatch spriteBatch, GuiPoint point, Rectangle clipRect)
        {
            int outerX0     = point.X + Offset.X;
            int outerY0     = point.Y + Offset.Y;
            int innerX0     = outerX0 + Border.Left;
            int innerY0     = outerY0 + Border.Top;
            int outerWidth  = RenderSize.Width;
            int outerHeight = RenderSize.Height;
            int innerWidth  = outerWidth - Border.Width;
            int innerHeigth = outerHeight - Border.Height;

            if (BorderColor != Color.Transparent)
            {
                Rectangle topRect    = new Rectangle(outerX0, outerY0, outerWidth - Border.Right, Border.Top);
                Rectangle bottomRect = new Rectangle(innerX0, outerY0 + innerHeigth + Border.Top, outerWidth, Border.Bottom);
                Rectangle leftRect   = new Rectangle(outerX0, innerY0, Border.Left, outerHeight);
                Rectangle rightRect  = new Rectangle(outerX0 + innerWidth + Border.Left, outerY0, Border.Right, outerHeight - Border.Bottom);
                if (Border.Top > 0)
                {
                    GuiPainter.DrawRectangle(spriteBatch, topRect, BorderColor, fTexture);
                }
                if (Border.Bottom > 0)
                {
                    GuiPainter.DrawRectangle(spriteBatch, bottomRect, BorderColor, fTexture);
                }
                if (Border.Left > 0)
                {
                    GuiPainter.DrawRectangle(spriteBatch, leftRect, BorderColor, fTexture);
                }
                if (Border.Right > 0)
                {
                    GuiPainter.DrawRectangle(spriteBatch, rightRect, BorderColor, fTexture);
                }
            }
            if (BackgroundColor != Color.Transparent)
            {
                Rectangle innerRect = new Rectangle(innerX0, innerY0, innerWidth, innerHeigth);
                GuiPainter.DrawRectangle(spriteBatch, innerRect, BackgroundColor, fTexture);
            }
            if (Content != null)
            {
                Rectangle childRect = new Rectangle(clipRect.Left + Border.Left, clipRect.Top + Border.Top, innerWidth, innerHeigth);

                Content.Draw(spriteBatch, new GuiPoint(point.X + Offset.X + Border.Left, point.Y + Offset.Y + Border.Top), childRect);
            }
            //base.DoDraw(spriteBatch, point, clipRect);
        }
Exemple #5
0
        protected override void DoDraw(SpriteBatch spriteBatch, GuiPoint point, Rectangle clipRect)
        {
            Rectangle r = new Rectangle(
                point.X + Offset.X,
                point.Y + Offset.Y,
                RenderSize.Width,
                RenderSize.Height);

            if (BackgroundColor != Color.Transparent)
            {
                GuiPainter.DrawRectangle(spriteBatch, r, BackgroundColor, fTexture);
            }
            if (Childs != null)
            {
                foreach (var child in Childs)
                {
                    GuiPoint childPoint = new GuiPoint(
                        point.X + Offset.X + child.X,
                        point.Y + Offset.Y + child.Y);
                    child.Control.Draw(spriteBatch, childPoint, clipRect);
                }
            }
        }
Exemple #6
0
        public override void LoadContent(GuiEngine engine)
        {
            fTexture = GuiPainter.GetTexture1x1(Device);

            /*
             * int w = 100;
             * int h = 2;
             * int pixels = w * h;
             * Color[] colors = new Color[pixels];
             * Texture2D texture = new Texture2D(device, w,h);
             * int index = 0;
             * for (int y = 0; y < h; y++)
             * {
             *  for (int x = 0; x < w; x++)
             *  {
             *      Color c = new Color(1.0f*x / w, 1.0f * y / h, 1.0f);
             *      colors[index++] = c;
             *  }
             * }
             * texture.SetData<Color>(colors);
             * fTexture = texture;
             */
            base.LoadContent(engine);
        }
Exemple #7
0
        public override void Initialize(GraphicsDevice device)
        {
            base.Initialize(device);

            fTexture = GuiPainter.CreateTexture1x1(device);
        }
Exemple #8
0
        public override void LoadContent(GuiEngine engine)
        {
            fTexture = GuiPainter.GetTexture1x1(Device);

            base.LoadContent(engine);
        }