public void Update() { int xx = Mouse.GetCursorState().X - Program.mainWindow.X; int yy = Mouse.GetCursorState().Y - Program.mainWindow.Y - 32; if ((xx > 0 && xx < Program.mainWindow.X + Program.mainWindow.Width) || (yy > 0 && yy < Program.mainWindow.Y + Program.mainWindow.Height)) { Program.mainWindow.Cursor = MouseCursor.Empty; } foreach (Line l in d.getLines()) { SplineManipulator(l); } if (IM.KeyDown(Key.H)) { hide = !hide; } if (IM.KeyDown(Key.Space)) { if (d.lines.Count == 0) { d.lines.Add(new Line()); } d.lines[lineIndex].splines.Add(new Spline(IM.FmouseVec())); } if (IM.KeyDown(Key.Enter)) { d.lines.Add(new Line()); lineIndex++; } if (IM.KeyDown(Key.BackSpace)) { d.lines[lineIndex].splines.RemoveAt(d.lines[lineIndex].splines.Count - 1); } if (IM.KeyDown(Key.C)) { d.lines[lineIndex].complete = !d.lines[lineIndex].complete; } if (IM.KeyDown(Key.ShiftLeft)) { lockControlPoint = true; } if (IM.KeyUp(Key.ShiftLeft)) { lockControlPoint = false; } if (IM.KeyDown(Key.P)) { if (mHeldSpline != null) { File.WriteAllText("point.txt", VTools.pack(mHeldSpline.position)); } } if (IM.KeyDown(Key.L)) { string s = File.ReadAllText("point.txt"); File.WriteAllText("pointRead.txt", VTools.pack(VTools.unpack(s))); } }
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); } }