private void DrawBg(Graphic g) { // draw screen bg g.DrawRectangle(Vector2.Zero, ScreenSize.X, ScreenSize.Y, true, Color.White); // draw grid bg g.DrawRectangle(GridOrigin, GridArea.X, GridArea.Y, true, Color.DarkGray); // draw card slot for (int i = 0; i < GridSize; i++) { for (int j = 0; j < GridSize; j++) { Color cardColor = CardColors[0]; var cardPosition = new Vector2(i * CardWidth + (i + 1) * Spacing, j * CardHeight + (j + 1) * Spacing); g.DrawRectangle(GridOrigin + cardPosition, CardWidth, CardHeight, true, cardColor); } } }
public override void Draw(Graphic g) { g.DrawRectangle((_c.Position + _c.Margin.TopLeft) * _c.Scale, _c.Size * _c.Scale, true, ForegroundColor); g.Write(_c.Name, _font, _c.Bounds, HorizontalAlignment.Center, VerticalAlignment.Center, Style.FontColor); }
private void Draw(Graphic g) { // draw cards for (int i = 0; i < GridSize; i++) { for (int j = 0; j < GridSize; j++) { var cardValue = _cards[i][j]; if(cardValue == 0) continue; Color cardColor; if(!CardColors.TryGetValue(cardValue, out cardColor)) { cardColor = Color.White; } var cardPosition = new Vector2(i * CardWidth + (i + 1) * Spacing, j * CardHeight + (j + 1) * Spacing) + _offset[i][j]; g.DrawRectangle(GridOrigin + cardPosition, CardWidth, CardHeight, true, cardColor); // draw digit var cardRect = new Rect(GridOrigin.X + cardPosition.X, GridOrigin.Y + cardPosition.Y, CardWidth, CardHeight); var digitColor = cardValue > 2 ? Color.Black : Color.White; g.Write(cardValue.ToString(), _font, cardRect, HorizontalAlignment.Center, VerticalAlignment.Center, digitColor, 3); } } }