private static void DoGameOver() { CurItem = null; IsGameOver = true; Font font = new Font(SystemFonts.DefaultFont.FontFamily, 20, FontStyle.Bold); MainG.DrawString("Game Over", font, GOBrush, MainWidth, MainWidth * (VCount / 2)); }
private static void FillMain(int x, int y) { if (x < 0 || y < 0) { return; } MainG.FillRectangle(DrawBrush, MainSpace + x * (MainWidth + MainSpace), MainSpace + y * (MainWidth + MainSpace), MainWidth, MainWidth); }
public static void ReDrawMain() { MainG.Clear(ClearBrush.Color); var rects = new List <Rectangle>(); for (var i = 0; i <= HCount; i++) { rects.Add(new Rectangle(i * (MainWidth + MainSpace), 0, MainSpace, VCount * (MainWidth + MainSpace) + MainSpace)); } for (var i = 0; i <= VCount; i++) { rects.Add(new Rectangle(0, i * (MainWidth + MainSpace), HCount * (MainWidth + MainSpace) + MainSpace, MainSpace)); } MainG.FillRectangles(SpaceBrush, rects.ToArray()); for (var i = 0; i < MainItems.Length; i++) { for (var j = 0; j < HCount; j++) { if ((MainItems[i] & (1 << j)) != 0) { MainG.FillRectangle(DrawBrush, MainSpace + j * (MainWidth + MainSpace), MainSpace + i * (MainWidth + MainSpace), MainWidth, MainWidth); } } } if (CurItem != null) { foreach (var p in CurItem) { MainG.FillRectangle(DrawBrush, MainSpace + p.X * (MainWidth + MainSpace), MainSpace + p.Y * (MainWidth + MainSpace), MainWidth, MainWidth); } } if (IsGameOver) { DoGameOver(); } }