Exemple #1
0
        public void Render()
        {
            int mouseX = IM.MouseX();
            int mouseY = IM.MouseY();

            Renderer.drawRect(new FRect(-1f, -1f, 2f, 2f, false), backgroundColor);
            Renderer.drawLine(screenBoundPoints, Color.Black);
            Renderer.drawLine(screenBound2Points, Color.Black);

            Rectangle rt = new Rectangle(100, 100, 200, 50);
            FRect     fr = Coordinates.RectToFRect(rt);
            FRect     r  = fr.shouldAdjustToAspect ? Coordinates.ApplyAspect(fr) : fr;

            Renderer.LineCircle(new Vector2(r.left, r.top), 0.01f, 10, Color.BlueViolet);
            //FlatUI.GUI.OutlineBox(Text.DrawStringR(new Vector2(-0.5f, 0f), 0.5f, "Make a good rect for me here! ♥", Color.Crimson));



            if (FlatUI.button(rt, "test button"))
            {
                Random ra = new Random();

                backgroundColor = Color.FromArgb(ra.Next(0, 255), ra.Next(0, 255), ra.Next(0, 255));
            }



            Text.DrawString(new Vector2(-0.3f, -0.5f), 0.5f, "Hello this is a test");
            Text.DrawString(new Vector2(-0.3f, -0.6f), 0.5f, "Please work as intended");
            Text.DrawString(new Vector2(-0.3f, 0.6f), 0.5f, "Mouse Left: " + IM.GetMouseButton(MouseButton.Left).ToString());
            Text.DrawString(new Vector2(-0.3f, 0.7f), 0.5f, "Mouse Left Down: " + IM.MouseButtonDown(MouseButton.Left).ToString());
            Text.DrawString(new Vector2(-0.3f, 0.8f), 0.5f, "Mouse Left Up: " + IM.MouseButtonUp(MouseButton.Left).ToString());



            Text.DrawString(IM.FmouseVec(), 0.5f, "(" + Math.Round(IM.FmouseX(), 2).ToString() + "," + Math.Round(IM.FmouseY(), 2).ToString() + ")");


            if (stampLetter.stamps.Count > 0)
            {
                foreach (stampLetter s in stampLetter.stamps)
                {
                    Text.DrawString(s.pos, 0.05f, s.value.ToString());
                }
            }


            Color c = Color.Black;

            if (IM.GetMouseButton(MouseButton.Left))
            {
                c = Color.Red;
            }
            else
            {
                foreach (Line l in d.getLines())
                {
                    foreach (Spline s in l.splines)
                    {
                        if (IM.FisMouseInRect(new FRect(s.position, 0.04f)) || IM.FisMouseInRect(new FRect(s.leftPos, 0.04f)) || IM.FisMouseInRect(new FRect(s.rightPos, 0.04f)))
                        {
                            c = Color.Magenta;
                        }
                    }
                }
            }
            Renderer.LineCircle(IM.FmouseVec(), 0.004f, 20, c);

            if (!hide)
            {
                Line[] array = d.getLines();
                for (int i = 0; i < array.Length; i++)
                {
                    Line l = array[i];
                    if (i == lineIndex)
                    {
                        foreach (Spline s in l.splines)
                        {
                            Renderer.drawSpline(s, Color.Black);
                        }
                    }
                    else
                    {
                        foreach (Spline s in l.splines)
                        {
                            Renderer.drawSpline(s, Color.Gray);
                        }
                    }
                }
            }
            foreach (Line l in d.getLines())
            {
                Renderer.drawLineCurve(l, 40, Color.Black);
            }
        }
Exemple #2
0
 private void SplineManipulator(Line l)
 {
     if (mHeldSpline != null)
     {
         if (IM.GetMouseButton(MouseButton.Left))
         {
             if (mControlPoint == 0)
             {
                 mHeldSpline.position = new Vector2(IM.FmouseX() + mOffset.X, IM.FmouseY() + mOffset.Y);
             }
             else if (mControlPoint == 1)
             {
                 if (lockControlPoint)
                 {
                     mHeldSpline.moveControlPointLocked(new Vector2(IM.FmouseX() + mOffset.X, IM.FmouseY() + mOffset.Y), true);
                 }
                 else
                 {
                     mHeldSpline.moveControlPoint(new Vector2(IM.FmouseX() + mOffset.X, IM.FmouseY() + mOffset.Y), true);
                 }
             }
             else
             {
                 if (lockControlPoint)
                 {
                     mHeldSpline.moveControlPointLocked(new Vector2(IM.FmouseX() + mOffset.X, IM.FmouseY() + mOffset.Y), false);
                 }
                 else
                 {
                     mHeldSpline.moveControlPoint(new Vector2(IM.FmouseX() + mOffset.X, IM.FmouseY() + mOffset.Y), false);
                 }
             }
         }
         else
         {
             mHeldSpline = null;
         }
     }
     else
     {
         foreach (Spline s in l.splines)
         {
             if (IM.MouseButtonDown(MouseButton.Left))
             {
                 if (IM.FisMouseInRect(new FRect(s.GlobalLeft(), 0.04f)))
                 {
                     mOffset       = new Vector2(s.GlobalLeft().X - IM.FmouseX(), s.GlobalLeft().Y - IM.FmouseY());
                     mHeldSpline   = s;
                     mControlPoint = 1;
                     lineIndex     = d.lines.IndexOf(l);
                 }
                 if (IM.FisMouseInRect(new FRect(s.GlobalRight(), 0.04f)))
                 {
                     mOffset       = new Vector2(s.GlobalRight().X - IM.FmouseX(), s.GlobalRight().Y - IM.FmouseY());
                     mHeldSpline   = s;
                     mControlPoint = 2;
                     lineIndex     = d.lines.IndexOf(l);
                 }
                 else if (IM.FisMouseInRect(new FRect(s.position, 0.04f)))
                 {
                     mOffset       = new Vector2(s.position.X - IM.FmouseX(), s.position.Y - IM.FmouseY());
                     mHeldSpline   = s;
                     mControlPoint = 0;
                     lineIndex     = d.lines.IndexOf(l);
                 }
             }
         }
     }
 }