public MRectangle(MPoint _leftTopCorner, int width, int height) { leftTopX = _leftTopCorner.x; leftTopY = _leftTopCorner.y; rightBottomX = _leftTopCorner.x + width - 1; rightBottomY = _leftTopCorner.y + height - 1; }
public MRectangle(MPoint _leftTopCorner, MPoint _rightBottomCorner) { leftTopX = _leftTopCorner.x; leftTopY = _leftTopCorner.y; rightBottomX = _rightBottomCorner.x; rightBottomY = _rightBottomCorner.y; }
public static MEvent RedrawEvent(MPoint where, MWidget sender) { return(new MEvent(MEventType.Redraw, new List <int>() { where.x, where.y }, sender)); }
public override void Redraw(MPoint leftUpCorner) { base.Redraw(leftUpCorner); Header.Redraw(leftUpCorner); Text.Redraw(leftUpCorner.Add(1, 1)); OkButton.Redraw(leftUpCorner.AddX(GetWidth / 2 - 3).AddY(GetHeight - 1)); }
public override void Redraw(MPoint leftUpCorner) { base.Redraw(leftUpCorner); for (int i = 0; i < Text.Count; ++i) { MDrawHandler.DrawStringInPoint(leftUpCorner.AddY(i), Color, Text[i], Width); } }
public virtual void RedrawFull(MPoint where, int maxWidth) { MDrawHandler.DrawStringInPoint(where, MDrawHandlerMTG.DefaultColor, String.Format("{0}'s {1}", host.PlayerName, name), maxWidth); for (int i = 0; i < list.Count; ++i) { list[i].DrawHeader(where.Add(i + 1, 2), maxWidth - 2); } }
public override void Redraw(MPoint leftUpCorner) { base.Redraw(leftUpCorner); for (int i = 0; i < 4; ++i) { MDrawHandler.DrawStringInPoint(leftUpCorner.Add(1, 1 + i), Color, "TEST"); } }
public static void DrawRectangleBorder(MRectangle rec, CColor color) { SetCursor(rec.From); MPoint leftBottom = MoveCursorFromLastY(rec.Height); MPoint rightTop = MoveCursorFromLastX(rec.Width); DrawStringInPoint(rec.From, color, "".PadLeft(rec.Width)); DrawStringInPoint(leftBottom, color, "".PadLeft(rec.Width)); DrawLine(rec.From, leftBottom, color); DrawLine(rec.To, rightTop, color); }
public override void Redraw(MPoint leftUpCorner) { base.Redraw(leftUpCorner); int yOffset = 0; int width = GetWidth; foreach (MWidget w in Children) { MPoint where = new MPoint(leftUpCorner.x + width / 2 - w.GetWidth / 2, leftUpCorner.y + yOffset); w.Redraw(where); yOffset += spaceHeight + w.GetHeight; } }
public override void Redraw(MPoint leftUpCorner) { base.Redraw(leftUpCorner); int xOffset = 0; int height = GetHeight; foreach (MWidget w in Children) { MPoint where = new MPoint(leftUpCorner.x + xOffset, leftUpCorner.y + height / 2 - w.GetHeight / 2); w.Redraw(where); xOffset += spaceWidth + w.GetWidth; } }
public virtual void Redraw(MPoint leftUpCorner) { //Logs.Trace(String.Format("{0} was redrawn at ({1};{2})", name, leftUpCorner.x, leftUpCorner.y)); //if (LastRedrawPoint.isEmpty) { MDrawHandler.DrawRectangle(leftUpCorner, GetWidth, GetHeight, Color); //MDrawHandler.DrawRectangleBorder(new MRectangle(leftUpCorner, GetWidth, GetHeight), new CColor(ConsoleColor.Gray)); } LastRedrawPoint = leftUpCorner; //MDrawHandler.DrawStringInPoint(leftUpCorner, Color, String.Format("{0} -- ({1};{2})", name, GetWidth, GetHeight), GetWidth); }
public static void DrawPlayer(MPoint where, Player who, int Width) { int maxWidth = Width / 2; int ostWidth = Width - maxWidth; MDrawHandler.DrawStringInPoint(where, MDrawHandlerMTG.DefaultColor, who.PlayerName, maxWidth); int offset = 1; who.hand.RedrawFull(where.AddY(offset), maxWidth); offset += who.hand.Count + 1; who.deck.RedrawFull(where.AddY(offset), maxWidth); offset += who.deck.Count + 1; who.graveyard.RedrawFull(where.AddY(offset), maxWidth); offset += who.graveyard.Count + 1; who.exile.RedrawFull(where.AddY(offset), maxWidth); offset += who.exile.Count + 1; who.field.RedrawFull(where.Add(maxWidth, 1), ostWidth); }
public static void DrawManaCostAtCardHeader(MPoint where, ManaCost mc) { int offset = 0; if (mc.Any != 0 || mc.ConvertedManaCost == 0) { MDrawHandler.DrawStringInPoint(where.AddX(offset), anyManaColor, mc.Any.ToString()); offset += mc.Any.ToString().Length; } MDrawHandler.DrawStringInPoint(where.AddX(offset), whiteManaColor, "".PadLeft(mc.White, whiteColorManaSymbol)); offset += mc.White; MDrawHandler.DrawStringInPoint(where.AddX(offset), blueManaColor, "".PadLeft(mc.Blue, blueColorManaSymbol)); offset += mc.Blue; MDrawHandler.DrawStringInPoint(where.AddX(offset), blackManaColor, "".PadLeft(mc.Black, blackColorManaSymbol)); offset += mc.Black; MDrawHandler.DrawStringInPoint(where.AddX(offset), redManaColor, "".PadLeft(mc.Red, redColorManaSymbol)); offset += mc.Red; MDrawHandler.DrawStringInPoint(where.AddX(offset), greenManaColor, "".PadLeft(mc.Green, greenColorManaSymbol)); offset += mc.Green; }
public static MPoint Trace(String S) { if (!Write) { return(new MPoint(-1, -1)); } logs.Add(S); // clear all if (logs.Count % height == 0) { MDrawHandler.DrawRectangle(new MRectangle(leftTopCorner, width, height), new CColor(ConsoleColor.Black)); } MPoint where = leftTopCorner.AddY(logs.Count % height); MDrawHandler.DrawStringInPoint(where, logColor, S, width); return(where); }
public override void Redraw(MPoint leftUpCorner) { base.Redraw(leftUpCorner); for (int i = 0; i < ((height < 0) ? LineCount : (height - 2)); ++i) { if (i == selectedIndex) { lines[i].setMainColor(selectedColor); } lines[i].Redraw(leftUpCorner.Add(1, 1 + i)); if (i == selectedIndex) { lines[i].setDefaultColors(); } } }
public static MPoint TraceMarked(String S, List <String> Events) { if (!Write) { return(new MPoint(-1, -1)); } MPoint where = Trace(S); foreach (String e in Events) { int offset = S.IndexOf(e); if (offset >= 0) { MDrawHandler.DrawStringInPoint(where.AddX(offset), markedColor, e, e.Length); } } return(where); }
public static void DrawRectangle(MPoint where, int width, int height, CColor color) { DrawRectangle(new MRectangle(where, width, height), color); }
private static void MoveCursor(MPoint where) { Console.SetCursorPosition(where.x, where.y); }
private static void SetCursor(MPoint where) { Console.SetCursorPosition(where.x, where.y); pointStack.Push(where); }
public static void DrawStringInPoint(MPoint where, CColor c, String S, int maxSymbols) { SetCursor(where.x, where.y); c.Apply(); Console.Write(Short(S, maxSymbols)); }
public static void DrawStringInPoint(MPoint where, CColor c, String S) { SetCursor(where.x, where.y); c.Apply(); Console.Write(S); }
public static void DrawRectangle(MPoint from, MPoint to, CColor color) { DrawRectangle(new MRectangle(from, to), color); }
public static void DrawLine(MPoint from, MPoint to, CColor color) { DrawLine(from.x, from.y, to.x, to.y, color); }
public override void Redraw(MPoint leftUpCorner) { base.Redraw(leftUpCorner); MDrawHandlerMTG.DrawManaCostAtCardHeader(leftUpCorner, mana); }
public virtual void DrawHeader(MPoint where, int maxWidth) { MDrawHandler.DrawStringInPoint(where, MDrawHandlerMTG.ColorOf(color), name, maxWidth); }
public override void Redraw(MPoint leftUpCorner) { base.Redraw(leftUpCorner); MDrawHandler.DrawStringInPoint(leftUpCorner, Color, DrawText, Width); }