Example #1
0
        void PicMainClick(object sender, EventArgs e)
        {
            switch (mainWindow.gameState)
            {
            case "Title":
                if (isPointInRectangle(getMousePoint(this, this.ClientRectangle),
                                       newRectPoint2Point(allignPoint(mainWindow.area, 31, 60), allignPoint(mainWindow.area, 70, 71))))
                {
                    mainWindow.setState("Main");
                    DisplayBoard(picMain, gameBoard, mainWindow);
                    spawnEnemies(EnemyCount, EnemySpeed);
                }
                break;

            case "Main":
                mouseDown = true;
                break;

            default:

                break;
            }
        }
Example #2
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;
        }