public override void Draw() { // may be the luck with drawing on two windows parallel-ly ran out... bool isHost = _role == MultiplayerRole.Host; MultiplayerData data = _connection.CurrentData; PlayerData host = isHost ? data.Host : data.Guest, guest = isHost ? data.Guest : data.Host; // draw player side InformationBar.Draw( TimeFormatter.GetTime(_connection.TimePlayed), (host.Board as MinesweeperBoard).Flag, _playerProps.WindowWidth ); DrawBoard(host.Board.DrawableBoard); // a line in between screens int wW = _playerProps.WindowWidth, wH = _playerProps.WindowHeight; SplashKit.DrawLine(Constants.TEXT_COLOR, wW, 0, wW, wH); // draw opponent side InformationBar.Draw( TimeFormatter.GetTime(guest.Time), guest.Flag, _opponentProps.WindowWidth, true, _playerProps.WindowWidth ); DrawBoard(guest.Board.DrawableBoard, true); }
public override void Draw() { if (Selected) { DrawOutline(); } SplashKit.DrawLine(Color, X, Y, (X + _length), Y); }
// Prints the grid to screen. public void PrintGrid() { for (int columnIndex = 0; columnIndex < _gridArea.GetLength(0); columnIndex++) { for (int rowIndex = 0; rowIndex < _gridArea.GetLength(1); rowIndex++) { SplashKit.DrawLine(Color.Black, GetAPoint(columnIndex, rowIndex), GetAPoint(columnIndex, rowIndex + 1)); SplashKit.DrawLine(Color.Black, GetAPoint(columnIndex, rowIndex + 1), GetAPoint(columnIndex + 1, rowIndex + 1)); } SplashKit.DrawLine(Color.Black, GetAPoint(0, 0), GetAPoint(_column, 0)); SplashKit.DrawLine(Color.Black, GetAPoint(_column, 0), GetAPoint(_column, _row)); } }
public override void Draw() { double leftX, midX, rightX; double midY, eyeY, mouthY; leftX = _x + 17; midX = _x + 25; rightX = _x + 33; midY = _y + 25; eyeY = _y + 20; mouthY = _y + 35; SplashKit.FillCircle(Color.White, midX, midY, 25); SplashKit.DrawCircle(Color.Gray, midX, midY, 25); SplashKit.FillCircle(_mainColour, leftX, eyeY, 5); SplashKit.FillCircle(_mainColour, rightX, eyeY, 5); SplashKit.FillEllipse(Color.Gray, _x, eyeY, 50, 30); SplashKit.DrawLine(Color.Black, _x, mouthY, _x + 50, _y + 35); }
public override void Draw() { double leftX, midX, rightX; double midY, eyeY, mouthY; leftX = X + 17; midX = X + 25; rightX = X + 33; midY = Y + 25; eyeY = Y + 20; mouthY = Y + 35; SplashKit.FillCircle(Color.White, midX, midY, 25); SplashKit.DrawCircle(Color.Gray, midX, midY, 25); // SplashKit.FillCircle(MainColor, leftX, eyeY, 5); // SplashKit.FillCircle(MainColor, rightX, eyeY, 5); SplashKit.FillEllipse(Color.Gray, X, eyeY, 50, 30); SplashKit.DrawLine(Color.Black, X, mouthY, X + 50, Y + 35); }
/// <summary> /// Draws the sudoku board to the window /// </summary> /// <param name="window">The window to draw the board onto</param> public void Draw(Window window) { for (int y = 0; y < 9; y++) { for (int x = 0; x < 9; x++) { Cell cell = GetCell(x, y); string text = cell.Value.ToString(); // Determine font string font = IsDefaultCell(x, y) ? Cell.DefaultFont : Cell.UserFont; // Get text dimensions int textW = SplashKit.TextWidth(text, font, Cell.FontSize); int textH = SplashKit.TextHeight(text, font, Cell.FontSize); Point2D p = GetCellScreenPosition(cell); double w = Cell.Width; // Highlight selected cell if (IsSelected(cell)) { SplashKit.FillRectangle(Cell.SelectedColor, p.X, p.Y, w, w); } else if (CellContainsPoint(cell, SplashKit.MousePosition()) && !IsSolved()) { SplashKit.FillRectangle(Cell.HoverColor, p.X, p.Y, w, w); } // Draw cell value if (cell.HasValue()) { p.X += (w / 2) - (textW / 2); p.Y += (w / 2) - (textH / 2); Color color; if (IsSelected(cell)) { color = Cell.SelectedNumColor; } else { if (IsDefaultCell(cell)) { color = Cell.DefaultNumColor; } else { color = Cell.UserNumColor; } } SplashKit.DrawText(text, color, font, Cell.FontSize, p.X, p.Y); } } } DrawingOptions thinLineOpts = new DrawingOptions { Dest = window, LineWidth = ThinLineThickness }; DrawingOptions thickLineOpts = new DrawingOptions { Dest = window, LineWidth = ThickLineThickness }; // Draw grid lines for (int i = 0; i <= 9; i++) { double offset = (i - 4.5) * Cell.Width; double extents = ThickLineThickness / 2; // Determine line thickness DrawingOptions opts = (i % 3 == 0) ? thickLineOpts : thinLineOpts; // Draw vertical line SplashKit.DrawLine( LineColor, _position.X + offset, _position.Y - 4.5 * Cell.Width - extents, _position.X + offset, _position.Y + 4.5 * Cell.Width + extents, opts ); // Draw horizontal line SplashKit.DrawLine( LineColor, _position.X - 4.5 * Cell.Width - extents, _position.Y + offset, _position.X + 4.5 * Cell.Width + extents, _position.Y + offset, opts ); } }
public void Draw() { SplashKit.DrawBitmap(Image, _x, _y); SplashKit.DrawLine(Color.LimeGreen, _x + Width / 2, _y, _connectedLight.X + _connectedLight.Width / 2, _connectedLight.Y + _connectedLight.Height); }