public void Render(IDisplay <IDTSudokuAssets> display) { if (this.sudokuBoardFrameSection != null) { TranslatedDTSudokuDisplay translatedDisplay = new TranslatedDTSudokuDisplay(display, 25, 25); this.sudokuBoardFrameSection.Render(translatedDisplay); if (this.sudokuBoardFrameSection.IsSolved()) { display.GetAssets().DrawImage(DTSudokuImage.SolvedText, 25, 25 + 450 + 15); } } TranslatedDTSudokuDisplay translatedDisplay2 = new TranslatedDTSudokuDisplay(display, 25, 555); this.sudokuDifficultySelectionFrameSection.Render(translatedDisplay2); TranslatedDTSudokuDisplay translatedDisplay3 = new TranslatedDTSudokuDisplay(display, 125, 620); this.sudokuNewGameButtonFrameSection.Render(translatedDisplay3); if (this.sudokuLoadingBoardFrameSection != null) { DTColor semiTransparentGray = new DTColor(0, 0, 0, 100); display.DrawRectangle(25, 25, 450, 450, semiTransparentGray, true); display.DrawRectangle(25, 555, 451, 51, semiTransparentGray, true); display.DrawRectangle(125, 620, 251, 51, semiTransparentGray, true); display.GetAssets().DrawImage(DTSudokuImage.LoadingText, 25, 25); } }
public void Render(TranslatedDTSudokuDisplay display) { DTColor black = new DTColor(0, 0, 0); display.DrawImage(DTSudokuImage.DifficultyText, 0, 0); display.DrawImage(DTSudokuImage.EasyText, 151, 1); display.DrawImage(DTSudokuImage.NormalText, 251, 1); display.DrawImage(DTSudokuImage.HardText, 351, 1); if (this.currentlySelectedDifficultyValue == DTSudokuDifficultyValue.Easy) { display.DrawImage(DTSudokuImage.HighlightedDifficulty, 151, 1); } else if (this.currentlySelectedDifficultyValue == DTSudokuDifficultyValue.Normal) { display.DrawImage(DTSudokuImage.HighlightedDifficulty, 251, 1); } else if (this.currentlySelectedDifficultyValue == DTSudokuDifficultyValue.Hard) { display.DrawImage(DTSudokuImage.HighlightedDifficulty, 351, 1); } else { throw new Exception(); } display.DrawRectangle(150, 0, 101, 51, black, false); display.DrawRectangle(250, 0, 101, 51, black, false); display.DrawRectangle(350, 0, 101, 51, black, false); }
public void Render(TranslatedDTSudokuDisplay display) { DTColor black = new DTColor(0, 0, 0); display.DrawImage(DTSudokuImage.NewGameText, 1, 1); if (this.isHoveringOverNewGame) { display.DrawImage(DTSudokuImage.HighlightedNewGame, 1, 1); } display.DrawRectangle(0, 0, 251, 51, black, false); }
public void Render(TranslatedDTSudokuDisplay display) { DTColor black = new DTColor(0, 0, 0); for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if (this.currentBoard[i, j] != 0) { CellStatus cellStatus = CellStatus.Given; if (this.currentBoard[i, j] != this.initialBoard[i, j]) { cellStatus = CellStatus.Correct; } if (this.currentBoard[i, j] != this.solvedBoard[i, j]) { cellStatus = CellStatus.Wrong; } this.DrawNumber(this.currentBoard[i, j], cellStatus, WIDTH * i + 1, WIDTH * j + 1, display); } } } if (this.selectedCell != null) { int x = this.selectedCell.Item1; int y = this.selectedCell.Item2; display.DrawImage(DTSudokuImage.HighlightedCell, WIDTH * x + 1, WIDTH * y + 1); } for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { display.DrawRectangle(WIDTH * i, WIDTH * j, WIDTH + 1, WIDTH + 1, black, false); } } for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { int xOffset = i * WIDTH * 3; int yOffset = j * WIDTH * 3; display.DrawThickRectangle(xOffset, yOffset, WIDTH * 3 + 1, WIDTH * 3 + 1, 2, black, false); } } }
private void DrawNumber(int num, CellStatus cellStatus, int x, int y, TranslatedDTSudokuDisplay display) { DTSudokuImage image; if (cellStatus == CellStatus.Given) { if (num == 1) { image = DTSudokuImage.BlackOne; } else if (num == 2) { image = DTSudokuImage.BlackTwo; } else if (num == 3) { image = DTSudokuImage.BlackThree; } else if (num == 4) { image = DTSudokuImage.BlackFour; } else if (num == 5) { image = DTSudokuImage.BlackFive; } else if (num == 6) { image = DTSudokuImage.BlackSix; } else if (num == 7) { image = DTSudokuImage.BlackSeven; } else if (num == 8) { image = DTSudokuImage.BlackEight; } else if (num == 9) { image = DTSudokuImage.BlackNine; } else { throw new Exception(); } } else if (cellStatus == CellStatus.Correct) { if (num == 1) { image = DTSudokuImage.BlueOne; } else if (num == 2) { image = DTSudokuImage.BlueTwo; } else if (num == 3) { image = DTSudokuImage.BlueThree; } else if (num == 4) { image = DTSudokuImage.BlueFour; } else if (num == 5) { image = DTSudokuImage.BlueFive; } else if (num == 6) { image = DTSudokuImage.BlueSix; } else if (num == 7) { image = DTSudokuImage.BlueSeven; } else if (num == 8) { image = DTSudokuImage.BlueEight; } else if (num == 9) { image = DTSudokuImage.BlueNine; } else { throw new Exception(); } } else if (cellStatus == CellStatus.Wrong) { if (num == 1) { image = DTSudokuImage.RedOne; } else if (num == 2) { image = DTSudokuImage.RedTwo; } else if (num == 3) { image = DTSudokuImage.RedThree; } else if (num == 4) { image = DTSudokuImage.RedFour; } else if (num == 5) { image = DTSudokuImage.RedFive; } else if (num == 6) { image = DTSudokuImage.RedSix; } else if (num == 7) { image = DTSudokuImage.RedSeven; } else if (num == 8) { image = DTSudokuImage.RedEight; } else if (num == 9) { image = DTSudokuImage.RedNine; } else { throw new Exception(); } } else { throw new Exception(); } display.DrawImage(image, x, y); }