public static void DoVKeys(this WidgetMidiList widget, FloatRect grid, Graphics g) { var gs = g.Save(); // Vertical using (var linePen = new Pen(Color.Blue, 1)) foreach (var row in widget.GetVLines(widget.LineOffset)) { var r = new FloatRect(widget.Container.X + 12, row.Top, widget.WidthGutter, widget.LineHeight); if (row.CanDo) { // Note-Number + Piano-KeyName var str = string.Format("{0:00#} {1,-3}", row.RowIndex, MKeys[row.RowIndex]); // create rect, then move x/y and shrinks w/h by one pixel. var rc = new FloatRect(grid.Left, row.Top, grid.Width, widget.LineHeight).Shrink(1); using (var sb = new SolidBrush(Color.FromArgb(24, row.IsIvory ? Color.White : Color.Black))) if (row.IsIvory) g.FillRectangle(sb, rc); var r2 = r.Clone(); r2.Location = r2.Location.NegX(10); g.DrawText(str,Color.White,widget.Font,r2,StringAlignment.Near); } } g.Restore(gs); }
public override void Design() { Bounds = new FloatRect(4,4,Parent.Size.Width,32); Widgets = new Widget[] { new WidgetMouse(Parent) { Bounds = new FloatRect(4,0,140,Height), }, new WidgetClock(Parent) { Bounds = new FloatRect(0,0, 200, Height), }, // new WidgetButton(Parent) { Bounds = new FloatRect(0,0,100,Height), Text = "ASOME" }, new WidgetButton(Parent) { Bounds = new FloatRect(0,0,Height,Height), Font=Parent.FontIndex["awesome",16.0f], Text=FontAwesome.Adjust, Smoother=true }, // new WidgetButton(Parent) { Bounds = new FloatRect(0,0,150,Height), Text = "CSOME" }, new WidgetSlideH(Parent) { Bounds = new FloatRect(0,0,250,Height), Text = "SLIDE", SliderValue = new DoubleMinMax() { Minimum = 0, Maximum = 1, Value = .5 } }, }; }
public static void DoGrid(this WidgetMidiList widget, FloatRect grid, Graphics g) { var gs = g.Save(); using (g.Clip = new Region(grid)) { using (var p0 = new Pen(Color.Black)) foreach (var i in widget.GetHLines(4)) g.DrawLines(p0, new Point[] { new FloatPoint(i.XO, grid.Top), new FloatPoint(i.XO, grid.Bottom) }); using (var p1 = new Pen(Gray130)) foreach (var i in widget.GetHLines(Convert.ToInt32(Math.Pow(4, 2)))) g.DrawLines(p1, new Point[] { new FloatPoint(i.XO, grid.Top), new FloatPoint(i.XO, grid.Bottom) }); using (var p2 = new Pen(White)) foreach (var i in widget.GetHLines(Convert.ToInt32(Math.Pow(4, 3)))) g.DrawLines(p2, new Point[] { new FloatPoint(i.XO, grid.Top), new FloatPoint(i.XO, grid.Bottom) }); g.ResetClip(); } g.Restore(gs); }
public override void Design() { Gap=0; Dock = DockStyle.Left; Bounds = new FloatRect(4,48,48,48); var DefaultBounds = new FloatRect(4, 48, 32, 32); var DPadding = new Padding(4); var awesome = Parent.FontIndex.GetFont("awesome", 19f, FontStyle.Regular, GraphicsUnit.Pixel); Widgets = new Widget[] { new WidgetButton(Parent) { Text = FontAwesome.Bars, Bounds = DefaultBounds, Padding=DPadding, Font=awesome, Smoother=true }, // bars BtnLoadMidi = new WidgetButton(Parent) { Text = FontAwesome.Music, Bounds = DefaultBounds.Clone(), Padding=DPadding, Font=awesome, Smoother=true }, // h-bars new WidgetButton(Parent) { Text = FontAwesome.EllipsisV, Bounds = DefaultBounds.Clone(), Padding=DPadding, Font=awesome, Smoother=true }, // v-bars new WidgetButton(Parent) { Text = FontAwesome.Play, Bounds = DefaultBounds.Clone(), Padding=DPadding, Font=awesome, Smoother=true }, // fore new WidgetButton(Parent) { Text = FontAwesome.Backward, Bounds = DefaultBounds.Clone(), Padding=DPadding, Font=awesome, Smoother=true }, // back new WidgetButton(Parent) { Text = FontAwesome.FolderOpen, Bounds = DefaultBounds.Clone(), Padding=DPadding, Font=awesome, Smoother=true }, // folder-open new WidgetButton(Parent) { Text = FontAwesome.FolderOpenO, Bounds = DefaultBounds.Clone(), Padding=DPadding, Font=awesome, Smoother=true }, // folder-open new WidgetButton(Parent) { Text = FontAwesome.Save, Bounds = DefaultBounds.Clone(), Padding=DPadding, Font=awesome, Smoother=true }, // font }; }
public static void DoNoteIds(this WidgetMidiList widget, FloatRect grid, Graphics g) { var gs = g.Save(); using (g.Clip = new Region(grid)) { foreach (var i in widget.GetHLines(Convert.ToInt32(Math.Pow(4, 2)))) { var r2=new FloatRect(i.XO-16,grid.Top,32,24); g.FillEllipse(Brushes.Black,r2); g.DrawText((i.Index / 4).ToString(),Color.White,widget.Font,r2); } foreach (var i in widget.GetHLines(Convert.ToInt32(Math.Pow(4, 3)))) { var r2=new FloatRect(i.XO-16,grid.Top+32,32,24); g.FillEllipse(Brushes.Black,r2); g.DrawText((i.Index / 64).ToString(),Color.White,widget.Font,r2); } g.ResetClip(); } g.Restore(gs); }
public static FloatRect Round(FloatRect source, int ith) { return new FloatRect(source.Location.Rounded,source.Size.Rounded); }
public static FloatRect Floor(FloatRect source) { return new FloatRect(source.Location.Floored,source.Size.Floored); }
/// <summary> /// </summary> /// <param name="rect"></param> /// <param name="padding"></param> /// <returns></returns> public static FloatRect ApplyPadding(FloatRect rect, Padding padding) { var rectangle = rect.Clone(); rectangle.Location += new FloatPoint(padding.Left,padding.Top); rectangle.Size.X -= padding.Horizontal; rectangle.Size.Y -= padding.Vertical; return rectangle; }
void drawdot(Graphics g, FloatRect clientrect, int wedge) { float line1 = GetLineHeight(g,big,1); NoteTransport s = NoteSegment; FloatPoint f = s.ClientInput; f += clientrect.Location; f.Y -= line1; f.Y -= line1; g.DrawString(s.Human, big, SystemBrushes.WindowText, f ); s=null; }
protected void SpaceUnits(float ms) { var readOnlyList = new Dictionary<ushort, EntityBase>(entities); var spacedUnits = new List<ushort>(); float spaceAngle = 0; foreach (EntityBase entityBase in readOnlyList.Values) { //TODO: Add Unit Type Enum so we don't have to use an "is" check //Workers have to be able to go through units because it disrupts mining if (spacedUnits.Contains(entityBase.WorldId) || entityBase.rallyPoints.Count > 0 || !(entityBase is UnitBase)) continue; var entRect = new FloatRect(entityBase.Position.X - (Globals.SPACE_BOUNDS/2), entityBase.Position.Y - (Globals.SPACE_BOUNDS/2), Globals.SPACE_BOUNDS, Globals.SPACE_BOUNDS); var cosine = (float) Math.Cos(spaceAngle); var sine = (float) Math.Sin(spaceAngle); foreach (EntityBase checkEntity in readOnlyList.Values) { if (!spacedUnits.Contains(checkEntity.WorldId) && checkEntity != entityBase && checkEntity is UnitBase) { var checkRect = new FloatRect(checkEntity.Position.X - (Globals.SPACE_BOUNDS/2), checkEntity.Position.Y - (Globals.SPACE_BOUNDS/2), Globals.SPACE_BOUNDS, Globals.SPACE_BOUNDS); if (entRect.Intersects(checkRect)) { entityBase.Position += new Vector2f((Globals.SPACING_SPEED*cosine)*ms, (Globals.SPACING_SPEED*sine)*ms); spacedUnits.Add(checkEntity.WorldId); } } } spaceAngle += Globals.SPACE_ANGLE_INCREASE; } }
public RoundRectRenderer(FloatRect rect, float radii, float tens) { rectangle = rect; corners = new CORNERS(radii); tension = tens; }
public RoundRectRenderer(FloatRect rect, CORNERS radii, float tens) { rectangle = rect; corners = radii; tension = tens; }