Beispiel #1
0
        public static void DisplayTile(Graphics gfx, Tile tile, gameWindow window)
        {
            switch (tile.state)
            {
            case "empty":
                fillAllignedRectPoint2Point(gfx, brushWhite, window.area, tile.x * TileSize, tile.y * TileSize, (tile.x * TileSize) + TileSize, (tile.y * TileSize) + TileSize);
                break;

            case "enemy":
                fillAllignedRectPoint2Point(gfx, brushBlack, window.area, tile.x * TileSize, tile.y * TileSize, (tile.x * TileSize) + TileSize, (tile.y * TileSize) + TileSize);
                break;

            case "cursor":
                fillAllignedRectPoint2Point(gfx, brushBlack, window.area, tile.x * TileSize, tile.y * TileSize, (tile.x * TileSize) + TileSize, (tile.y * TileSize) + TileSize);
                fillAllignedRectPoint2Point(gfx, brushWhite, window.area, (tile.x * TileSize) + 1, (tile.y * TileSize) + 1, ((tile.x * TileSize) + TileSize) - 1, ((tile.y * TileSize) + TileSize) - 1);
                break;

            case "click":
                fillAllignedRectPoint2Point(gfx, brushBlack, window.area, tile.x * TileSize, tile.y * TileSize, (tile.x * TileSize) + TileSize, (tile.y * TileSize) + TileSize);
                fillAllignedRectPoint2Point(gfx, brushWhite, window.area, (tile.x * TileSize) + 1, (tile.y * TileSize) + 1, ((tile.x * TileSize) + TileSize) - 1, ((tile.y * TileSize) + TileSize) - 1);
                fillAllignedRectPoint2Point(gfx, brushBlack, window.area, (tile.x * TileSize) + 2, (tile.y * TileSize) + 2, ((tile.x * TileSize) + TileSize) - 2, ((tile.y * TileSize) + TileSize) - 2);
                break;

            default:
                break;
            }
        }
Beispiel #2
0
        public static void DisplayBoard(PictureBox area, TileBoard board, gameWindow window)
        {
            Graphics gfx      = area.CreateGraphics();
            int      displayX = 0;
            int      displayY = 0;

            for (int x = 0; x < board.boardSizeX; x++)
            {
                displayY = 0;
                for (int y = 0; y < board.boardSizeY; y++)
                {
                    DisplayTile(gfx, board.board[x, y], window);
                    displayY += TileSize;
                }
                displayX += TileSize;
            }
        }
Beispiel #3
0
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //

            gameBoard = new TileBoard(BoardSize, BoardSize);
            gameBoard.FloodBoard(new Tile(0, "empty"));
            mainWindow  = new gameWindow(newRectPoint2Point(allignPoint(this.ClientRectangle, borderSize, 0), allignPoint(this.ClientRectangle, 100 - borderSize, 100)), picMain, 100, 100);
            leftWindow  = new gameWindow(newRectPoint2Point(allignPoint(this.ClientRectangle, 0, 0), allignPoint(this.ClientRectangle, borderSize, 100)), picMain, borderSize, borderSize);
            rightWindow = new gameWindow(newRectPoint2Point(allignPoint(this.ClientRectangle, 100 - borderSize, 0), allignPoint(this.ClientRectangle, 100, 100)), picMain, borderSize, borderSize);
            mainWindow.setState("Title");
            leftWindow.setState("OJ");
            rightWindow.setState("Scores");
            lostWidth  = this.Width - this.ClientRectangle.Width;
            lostHeight = this.Height - this.ClientRectangle.Height;
            mouseDown  = false;
        }
Beispiel #4
0
 public void DisplayMe(Graphics GFX, gameWindow window)
 {
     MainForm.DisplayTile(GFX, curTile, window);
 }
Beispiel #5
0
 public void ClearMe(Graphics GFX, gameWindow window)
 {
     curTile.state = "empty";
     MainForm.DisplayTile(GFX, curTile, window);
 }