Esempio n. 1
0
        public Surface()
        {
            area = Program.Area;
            Text = "Tetris";
            BackColor = Color.White;

            int ClientWidth = xMargin * 2 + squareLength * area.Field.GetLength(0) + xMargin / 2 + squareLength * 4;
            int ClientHeight = yMargin * 2 + squareLength * area.Field.GetLength(1);

            ClientSize = new Size(ClientWidth, ClientHeight);

            FormBorderStyle = FormBorderStyle.FixedSingle;
            MaximizeBox = false;
            StartPosition = FormStartPosition.CenterScreen;

            Font = new Font("Franklin Gothic", 15);

            DoubleBuffered = true;

            GravityTimer.Interval = 500;
            GravityTimer.Enabled = true;
            GravityTimer.Tick += GravityTimer_Tick;

            InitLabels();
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            CurrentName = new Dialog().Prompt("What's your name?", "Enter below:");

            Area = new PlayingArea();
            Surface = new Surface();
            SaveSystem = new SaveSystem();

            Surface.OnUserReaction += surface_OnUserReaction;
            Surface.OnGravity += surface_OnGravity;
            Area.OnCurrentTileReachedBottom += area_OnCurrentTileReachedBottom;
            Area.OnUserScored += area_OnUserScored;
            Area.OnGameEnds += area_OnGameEnds;

            SaveSystem.ReadHighscore();

            Surface.UpdateHighscoreLabel();

            Application.Run(Surface);
        }