public override void Draw(GameTime gameTime, IDrawContext drawContext)
        {
            base.Draw(gameTime, drawContext);

            var rect = new Rect();
            rect.Width = RenderSize.Width;
            rect.Height = 1;
            drawContext.DrawRectangle(rect, GridColor);

            rect.Y = RenderSize.Height - 1;
            drawContext.DrawRectangle(rect, GridColor);

            rect.Y = 0;
            rect.Width = 1;
            rect.Height = RenderSize.Height;
            for (int i = 0; i <= 16; i++)
            {
                rect.X = CellSize * i;
                drawContext.DrawRectangle(rect, GridColor);
            }

            rect.Width = CellSize - 1;
            rect.Height = CellSize - 1;
            rect.X = CellSize * Section.Index + 1;
            rect.Y = 1;
            drawContext.DrawRectangle(rect, CursorColor);
        }
Example #2
0
        // I/F
        public virtual void Draw(Control control, IDrawContext drawContext)
        {
            if (control.Focused)
            {
                if (FocusTexture != null)
                {
                    drawContext.DrawTexture(new Rect(control.RenderSize), FocusTexture, FocusColor);
                }
                else
                {
                    drawContext.DrawRectangle(new Rect(control.RenderSize), FocusColor);
                }
            }

            if (control.MouseOver)
            {
                if (MouseOverTexture != null)
                {
                    drawContext.DrawTexture(new Rect(control.RenderSize), MouseOverTexture, MouseOverColor);
                }
                else
                {
                    drawContext.DrawRectangle(new Rect(control.RenderSize), MouseOverColor);
                }
            }
        }
        public override void Draw(GameTime gameTime, IDrawContext drawContext)
        {
            base.Draw(gameTime, drawContext);

            var rect = new Rect();

            rect.Width  = RenderSize.Width;
            rect.Height = 1;
            drawContext.DrawRectangle(rect, GridColor);

            rect.Y = RenderSize.Height - 1;
            drawContext.DrawRectangle(rect, GridColor);

            rect.Y      = 0;
            rect.Width  = 1;
            rect.Height = RenderSize.Height;
            for (int i = 0; i <= 16; i++)
            {
                rect.X = CellSize * i;
                drawContext.DrawRectangle(rect, GridColor);
            }

            rect.Width  = CellSize - 1;
            rect.Height = CellSize - 1;
            rect.X      = CellSize * Section.Index + 1;
            rect.Y      = 1;
            drawContext.DrawRectangle(rect, CursorColor);
        }
        void DrawRectangle(IDrawContext drawContext, Rect bounds, Color color, Color borderColor, int borderThickness)
        {
            drawContext.DrawRectangle(bounds, borderColor);

            bounds.X      += borderThickness;
            bounds.Y      += borderThickness;
            bounds.Width  -= borderThickness * 2;
            bounds.Height -= borderThickness * 2;
            drawContext.DrawRectangle(bounds, color);
        }
Example #5
0
        void DrawElements(IDrawContext drawContext)
        {
            var rect = new Rect
            {
                Width  = CellSize - 1,
                Height = CellSize - 1
            };

            for (int y = 0; y < gridSize; y++)
            {
                rect.Y = CellSize * y + 1;
                for (int x = 0; x < gridSize; x++)
                {
                    var material = Section.GetMaterial(x, y);
                    if (material == null)
                    {
                        continue;
                    }

                    rect.X = CellSize * x + 1;
                    var color = material.DiffuseColor.ToColor();

                    drawContext.DrawRectangle(rect, color);
                }
            }
        }
Example #6
0
        // I/F
        public virtual void Draw(Control control, IDrawContext drawContext)
        {
            if (control.Focused)
            {
                if (FocusTexture != null)
                {
                    drawContext.DrawTexture(new Rect(control.RenderSize), FocusTexture, FocusColor);
                }
                else
                {
                    drawContext.DrawRectangle(new Rect(control.RenderSize), FocusColor);
                }
            }

            if (control.MouseOver)
            {
                if (MouseOverTexture != null)
                {
                    drawContext.DrawTexture(new Rect(control.RenderSize), MouseOverTexture, MouseOverColor);
                }
                else
                {
                    drawContext.DrawRectangle(new Rect(control.RenderSize), MouseOverColor);
                }
            }
        }
        // I/F
        public virtual void Draw(Control control, IDrawContext drawContext)
        {
            if (control.Focused)
            {
                if (FocusTexture != null)
                {
                    drawContext.DrawTexture(new Rect(control.RenderSize), FocusTexture, FocusColor);
                }
                else
                {
                    drawContext.DrawRectangle(new Rect(control.RenderSize), FocusColor);
                }
            }

            if (control.MouseOver)
            {
                if (MouseOverTexture != null)
                {
                    drawContext.DrawTexture(new Rect(control.RenderSize), MouseOverTexture, MouseOverColor);
                }
                else
                {
                    drawContext.DrawRectangle(new Rect(control.RenderSize), MouseOverColor);
                }
            }

            var listBoxItem = control as ListBoxItem;

            if (listBoxItem != null && listBoxItem.IsSelected)
            {
                if (SelectionTexture != null)
                {
                    drawContext.DrawTexture(new Rect(control.RenderSize), SelectionTexture, SelectionColor);
                }
                else
                {
                    drawContext.DrawRectangle(new Rect(control.RenderSize), SelectionColor);
                }
            }
        }
Example #8
0
        void DrawGrid(IDrawContext drawContext)
        {
            var rect = new Rect();

            rect.X      = 0;
            rect.Width  = RenderSize.Width;
            rect.Height = 1;
            for (int y = 0; y <= gridSize; y++)
            {
                rect.Y = CellSize * y;
                drawContext.DrawRectangle(rect, GridColor);
            }

            rect.Y      = 0;
            rect.Width  = 1;
            rect.Height = RenderSize.Height;
            for (int x = 0; x <= gridSize; x++)
            {
                rect.X = CellSize * x;
                drawContext.DrawRectangle(rect, GridColor);
            }
        }
        // I/F
        public virtual void Draw(Control control, IDrawContext drawContext)
        {
            var renderBounds = new Rect(control.RenderSize);

            // デフォルトは背景を透過にします。

            // 枠を白で描画します。
            var borderColor = Color.White;

            Rect lineBounds;

            lineBounds = renderBounds;
            lineBounds.Height = 1;
            drawContext.DrawRectangle(lineBounds, borderColor);

            lineBounds = renderBounds;
            lineBounds.Y += lineBounds.Height - 1;
            lineBounds.Height = 1;
            drawContext.DrawRectangle(lineBounds, borderColor);

            lineBounds = renderBounds;
            lineBounds.Width = 1;
            drawContext.DrawRectangle(lineBounds, borderColor);

            lineBounds = renderBounds;
            lineBounds.X += lineBounds.Width - 1;
            lineBounds.Width = 1;
            drawContext.DrawRectangle(lineBounds, borderColor);

            // マウス オーバの場合に枠の四辺に矩形を描画します。
            var mouseOverColor = (control.MouseDirectlyOver) ? Color.Red : Color.Blue;
            if (control.MouseOver)
            {
                Rect mouseOverBounds;
                int size = 8;

                mouseOverBounds = renderBounds;
                mouseOverBounds.X += (mouseOverBounds.Width - size) / 2;
                mouseOverBounds.Width = size;
                mouseOverBounds.Height = size;
                DrawRectangle(drawContext, mouseOverBounds, mouseOverColor, borderColor, 1);

                mouseOverBounds = renderBounds;
                mouseOverBounds.X += (mouseOverBounds.Width - size) / 2;
                mouseOverBounds.Y += renderBounds.Height - size;
                mouseOverBounds.Width = size;
                mouseOverBounds.Height = size;
                DrawRectangle(drawContext, mouseOverBounds, mouseOverColor, borderColor, 1);

                mouseOverBounds = renderBounds;
                mouseOverBounds.Y += (mouseOverBounds.Height - size) / 2;
                mouseOverBounds.Width = size;
                mouseOverBounds.Height = size;
                DrawRectangle(drawContext, mouseOverBounds, mouseOverColor, borderColor, 1);

                mouseOverBounds = renderBounds;
                mouseOverBounds.X += renderBounds.Width - size;
                mouseOverBounds.Y += (mouseOverBounds.Height - size) / 2;
                mouseOverBounds.Width = size;
                mouseOverBounds.Height = size;
                DrawRectangle(drawContext, mouseOverBounds, mouseOverColor, borderColor, 1);
            }

            // フォーカスを持つ場合に枠の四隅に矩形を描画します。
            var focusColor = (control.Focused) ? Color.Red : Color.Blue;
            if (control.Focused || control.LogicalFocused)
            {
                Rect focusBounds;
                int size = 8;

                focusBounds = renderBounds;
                focusBounds.Width = size;
                focusBounds.Height = size;
                DrawRectangle(drawContext, focusBounds, focusColor, borderColor, 1);

                focusBounds = renderBounds;
                focusBounds.X += renderBounds.Width - size;
                focusBounds.Width = size;
                focusBounds.Height = size;
                DrawRectangle(drawContext, focusBounds, focusColor, borderColor, 1);

                focusBounds = renderBounds;
                focusBounds.Y += renderBounds.Height - size;
                focusBounds.Width = size;
                focusBounds.Height = size;
                DrawRectangle(drawContext, focusBounds, focusColor, borderColor, 1);

                focusBounds = renderBounds;
                focusBounds.X += renderBounds.Width - size;
                focusBounds.Y += renderBounds.Height - size;
                focusBounds.Width = size;
                focusBounds.Height = size;
                DrawRectangle(drawContext, focusBounds, focusColor, borderColor, 1);
            }
        }
        void DrawRectangle(IDrawContext drawContext, Rect bounds, Color color, Color borderColor, int borderThickness)
        {
            drawContext.DrawRectangle(bounds, borderColor);

            bounds.X += borderThickness;
            bounds.Y += borderThickness;
            bounds.Width -= borderThickness * 2;
            bounds.Height -= borderThickness * 2;
            drawContext.DrawRectangle(bounds, color);
        }
        public override void Draw(Control control, IDrawContext drawContext)
        {
            drawContext.DrawRectangle(new Rect(control.RenderSize), Color.Black);

            base.Draw(control, drawContext);
        }
Example #12
0
 public virtual void Draw(Control control, IDrawContext drawContext)
 {
     drawContext.DrawRectangle(new Rect(control.RenderSize), control.BackgroundColor);
 }
        public override void Draw(Control control, IDrawContext drawContext)
        {
            drawContext.DrawRectangle(new Rect(control.RenderSize), Color.Black);

            base.Draw(control, drawContext);
        }
Example #14
0
        void DrawElements(IDrawContext drawContext)
        {
            var rect = new Rect
            {
                Width = CellSize - 1,
                Height = CellSize - 1
            };

            for (int y = 0; y < gridSize; y++)
            {
                rect.Y = CellSize * y + 1;
                for (int x = 0; x < gridSize; x++)
                {
                    var material = Section.GetMaterial(x, y);
                    if (material == null) continue;

                    rect.X = CellSize * x + 1;
                    var color = material.DiffuseColor.ToColor();

                    drawContext.DrawRectangle(rect, color);
                }
            }
        }
Example #15
0
        void DrawGrid(IDrawContext drawContext)
        {
            var rect = new Rect();

            rect.X = 0;
            rect.Width = RenderSize.Width;
            rect.Height = 1;
            for (int y = 0; y <= gridSize; y++)
            {
                rect.Y = CellSize * y;
                drawContext.DrawRectangle(rect, GridColor);
            }

            rect.Y = 0;
            rect.Width = 1;
            rect.Height = RenderSize.Height;
            for (int x = 0; x <= gridSize; x++)
            {
                rect.X = CellSize * x;
                drawContext.DrawRectangle(rect, GridColor);
            }
        }
        // I/F
        public virtual void Draw(Control control, IDrawContext drawContext)
        {
            var renderBounds = new Rect(control.RenderSize);

            // デフォルトは背景を透過にします。

            // 枠を白で描画します。
            var borderColor = Color.White;

            Rect lineBounds;

            lineBounds        = renderBounds;
            lineBounds.Height = 1;
            drawContext.DrawRectangle(lineBounds, borderColor);

            lineBounds        = renderBounds;
            lineBounds.Y     += lineBounds.Height - 1;
            lineBounds.Height = 1;
            drawContext.DrawRectangle(lineBounds, borderColor);

            lineBounds       = renderBounds;
            lineBounds.Width = 1;
            drawContext.DrawRectangle(lineBounds, borderColor);

            lineBounds       = renderBounds;
            lineBounds.X    += lineBounds.Width - 1;
            lineBounds.Width = 1;
            drawContext.DrawRectangle(lineBounds, borderColor);

            // マウス オーバの場合に枠の四辺に矩形を描画します。
            var mouseOverColor = (control.MouseDirectlyOver) ? Color.Red : Color.Blue;

            if (control.MouseOver)
            {
                Rect mouseOverBounds;
                int  size = 8;

                mouseOverBounds        = renderBounds;
                mouseOverBounds.X     += (mouseOverBounds.Width - size) / 2;
                mouseOverBounds.Width  = size;
                mouseOverBounds.Height = size;
                DrawRectangle(drawContext, mouseOverBounds, mouseOverColor, borderColor, 1);

                mouseOverBounds        = renderBounds;
                mouseOverBounds.X     += (mouseOverBounds.Width - size) / 2;
                mouseOverBounds.Y     += renderBounds.Height - size;
                mouseOverBounds.Width  = size;
                mouseOverBounds.Height = size;
                DrawRectangle(drawContext, mouseOverBounds, mouseOverColor, borderColor, 1);

                mouseOverBounds        = renderBounds;
                mouseOverBounds.Y     += (mouseOverBounds.Height - size) / 2;
                mouseOverBounds.Width  = size;
                mouseOverBounds.Height = size;
                DrawRectangle(drawContext, mouseOverBounds, mouseOverColor, borderColor, 1);

                mouseOverBounds        = renderBounds;
                mouseOverBounds.X     += renderBounds.Width - size;
                mouseOverBounds.Y     += (mouseOverBounds.Height - size) / 2;
                mouseOverBounds.Width  = size;
                mouseOverBounds.Height = size;
                DrawRectangle(drawContext, mouseOverBounds, mouseOverColor, borderColor, 1);
            }

            // フォーカスを持つ場合に枠の四隅に矩形を描画します。
            var focusColor = (control.Focused) ? Color.Red : Color.Blue;

            if (control.Focused || control.LogicalFocused)
            {
                Rect focusBounds;
                int  size = 8;

                focusBounds        = renderBounds;
                focusBounds.Width  = size;
                focusBounds.Height = size;
                DrawRectangle(drawContext, focusBounds, focusColor, borderColor, 1);

                focusBounds        = renderBounds;
                focusBounds.X     += renderBounds.Width - size;
                focusBounds.Width  = size;
                focusBounds.Height = size;
                DrawRectangle(drawContext, focusBounds, focusColor, borderColor, 1);

                focusBounds        = renderBounds;
                focusBounds.Y     += renderBounds.Height - size;
                focusBounds.Width  = size;
                focusBounds.Height = size;
                DrawRectangle(drawContext, focusBounds, focusColor, borderColor, 1);

                focusBounds        = renderBounds;
                focusBounds.X     += renderBounds.Width - size;
                focusBounds.Y     += renderBounds.Height - size;
                focusBounds.Width  = size;
                focusBounds.Height = size;
                DrawRectangle(drawContext, focusBounds, focusColor, borderColor, 1);
            }
        }
        // I/F
        public virtual void Draw(Control control, IDrawContext drawContext)
        {
            if (control.Focused)
            {
                if (FocusTexture != null)
                {
                    drawContext.DrawTexture(new Rect(control.RenderSize), FocusTexture, FocusColor);
                }
                else
                {
                    drawContext.DrawRectangle(new Rect(control.RenderSize), FocusColor);
                }
            }

            if (control.MouseOver)
            {
                if (MouseOverTexture != null)
                {
                    drawContext.DrawTexture(new Rect(control.RenderSize), MouseOverTexture, MouseOverColor);
                }
                else
                {
                    drawContext.DrawRectangle(new Rect(control.RenderSize), MouseOverColor);
                }
            }

            var listBoxItem = control as ListBoxItem;
            if (listBoxItem != null && listBoxItem.IsSelected)
            {
                if (SelectionTexture != null)
                {
                    drawContext.DrawTexture(new Rect(control.RenderSize), SelectionTexture, SelectionColor);
                }
                else
                {
                    drawContext.DrawRectangle(new Rect(control.RenderSize), SelectionColor);
                }
            }
        }
Example #18
0
 public void Draw(Control control, IDrawContext drawContext)
 {
     drawContext.DrawRectangle(new Rect(control.RenderSize), control.BackgroundColor);
 }