Esempio n. 1
0
 public void SetRectangleMode(RectangleMode mode)
 {
     _jsRuntime.InvokeVoid(
         _p5InvokeFunction,
         "rectMode",
         Rectangle.ToString(mode)
         );
 }
Esempio n. 2
0
        internal Style(Font font, Pen pen, SolidBrush brush, SolidBrush textBrush, StringFormat format,
                       RectangleMode rectMode, ImageMode imageMode, LineCap strokeMode, DBColorMode colorMode, bool fill)
        {
            Font      = new Font(font.FontFamily, font.Size);
            Pen       = new Pen(pen.Color, pen.Width);
            Brush     = new SolidBrush(brush.Color);
            TextBrush = new SolidBrush(textBrush.Color);

            Format = new StringFormat();
            Format.LineAlignment = format.LineAlignment;
            Format.Alignment     = format.Alignment;

            RectMode   = rectMode;
            ImageMode  = imageMode;
            StrokeMode = strokeMode;
            ColorMode  = colorMode;
            Fill       = fill;
        }
Esempio n. 3
0
        public virtual void LoadFrom(MyReader mr)
        {
            bool isRect = mr.LoadBool();

            if (isRect && ShowShape is CircleMode)
            {
                ShowShape = new RectangleMode();
            }
            else if (!isRect && ShowShape is RectangleMode)
            {
                ShowShape = new CircleMode();
            }
            ShowShape.X      = mr.LoadInt();
            ShowShape.Y      = mr.LoadInt();
            ShowShape.Width  = mr.LoadInt();
            ShowShape.Height = mr.LoadInt();
            ShowShape.Angle  = mr.LoadDouble();
            mr.LoadLineEnd();
            foreach (var item in uis)
            {
                item.LoadFrom(mr);
            }
            mr.LoadLineEnd();
        }
Esempio n. 4
0
 public void SetRectangleMode(RectangleMode mode)
 {
     RectangleMode = mode;
 }
Esempio n. 5
0
 public void SetRectangleMode(RectangleMode mode)
 {
     ((IStyle)Style).SetRectangleMode(mode);
 }
Esempio n. 6
0
 public SubBoard()
 {
     ShowShape = new RectangleMode(500, 500);
     initialize();
 }
Esempio n. 7
0
 /// <summary>
 /// Creates a rectangle.
 /// </summary>
 public GuiRect(RectangleMode mode, GuiVector2 arg1, GuiVector2 arg2)
 {
     this.mode = mode;
     this.arg1 = arg1;
     this.arg2 = arg2;
 }
Esempio n. 8
0
        public void Parse(CompileContext context, Stack <Token> stream)
        {
            // We have following parsing:
            // [Type:]GuiVector2, GuiVector2
            // where Type = MinMax | LeftBottomAndSize | RightBottomAndSize | LeftTopAndSize | RightTopAndSize

            // We first check for type.
            Token         token = stream.Pop();
            RectangleMode mode  = RectangleMode.MinMax;

            if (token.TokenId == TokenId.Identifier)
            {
                string id = token.Identifier;
                switch (id.ToLower())
                {
                case "minmax":
                    mode = RectangleMode.MinMax;
                    break;

                case "leftbottomandsize":
                    mode = RectangleMode.LeftBottomAndSize;
                    break;

                case "rightbottomandsize":
                    mode = RectangleMode.RightBottomAndSize;
                    break;

                case "lefttopandsize":
                    mode = RectangleMode.LeftTopAndSize;
                    break;

                case "righttopandsize":
                    mode = RectangleMode.RightTopAndSize;
                    break;

                default:
                    stream.Push(token);
                    throw new ParseException("Expected a valid type identifier for rectangle.");
                }

                token = stream.Pop();

                if (token.TokenId != TokenId.Colon)
                {
                    stream.Push(token);
                    throw new ParseException("If specifier for rectangle is used, it must be followed by ':'.");
                }

                token = stream.Pop();
            }

            stream.Push(token);

            ASTVector2 v1 = new ASTVector2(), v2 = new ASTVector2();

            v1.Parse(context, stream);

            token = stream.Pop();
            if (token.TokenId != TokenId.Comma)
            {
                stream.Push(token);
                throw new ParseException("Comma expected to seperate vectors in rectangle.");
            }

            v2.Parse(context, stream);


            // We now apply data.
            rectangle = new GuiRect(mode, v1.Vector, v2.Vector);
        }