Exemple #1
0
        public void DrawRectangle(int x, int y, int width, int height, DTColor color, bool fill)
        {
            int red   = color.R;
            int green = color.G;
            int blue  = color.B;
            int alpha = color.Alpha;

            var javascriptCode = "DTSudokuBridgeDisplayJavascript.drawRectangle("
                                 + BridgeDisplayUtil.IntToString(x)
                                 + ", "
                                 + BridgeDisplayUtil.IntToString(y)
                                 + ", "
                                 + BridgeDisplayUtil.IntToString(width)
                                 + ", "
                                 + BridgeDisplayUtil.IntToString(height)
                                 + ", "
                                 + BridgeDisplayUtil.IntToString(red)
                                 + ", "
                                 + BridgeDisplayUtil.IntToString(green)
                                 + ", "
                                 + BridgeDisplayUtil.IntToString(blue)
                                 + ", "
                                 + BridgeDisplayUtil.IntToString(alpha)
                                 + ", "
                                 + (fill ? "true" : "false")
                                 + ")";

            Script.Eval(javascriptCode);
        }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        public void DrawRectangle(int x, int y, int width, int height, DTColor color, bool fill)
        {
            Color agateLibColor = Color.FromArgb(color.Alpha, color.R, color.G, color.B);

            if (fill)
            {
                Display.FillRect(x, y, width, height, agateLibColor);
            }
            else
            {
                // Unclear why the "- 1" are necessary, but it seems to make the display render better.
                Display.DrawRect(x, y, width - 1, height - 1, agateLibColor);
            }
        }
Exemple #6
0
        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);
                }
            }
        }
Exemple #7
0
        public static void DrawThickRectangle <T>(this IDisplay <T> display, int x, int y, int width, int height, int additionalThickness, DTColor color, bool fill) where T : IAssets
        {
            display.DrawRectangle(x - additionalThickness, y - additionalThickness, width + additionalThickness * 2, 1 + additionalThickness * 2, color, true);
            display.DrawRectangle(x - additionalThickness, height - 1 + y - additionalThickness, width + additionalThickness * 2, 1 + additionalThickness * 2, color, true);
            display.DrawRectangle(x - additionalThickness, y - additionalThickness, 1 + additionalThickness * 2, height + additionalThickness * 2, color, true);
            display.DrawRectangle(width - 1 + x - additionalThickness, y - additionalThickness, 1 + additionalThickness * 2, height + additionalThickness * 2, color, true);

            if (fill)
            {
                display.DrawRectangle(x, y, width, height, color, true);
            }
        }
Exemple #8
0
 public void DrawThickRectangle(int x, int y, int width, int height, int additionalThickness, DTColor color, bool fill)
 {
     this.display.DrawThickRectangle(x + this.xOffset, y + this.yOffset, width, height, additionalThickness, color, fill);
 }
Exemple #9
0
 public void DrawRectangle(int x, int y, int width, int height, DTColor color, bool fill)
 {
     this.display.DrawRectangle(x + this.xOffset, y + this.yOffset, width, height, color, fill);
 }