예제 #1
0
파일: Surface.cs 프로젝트: Cserny/Tetris
        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();
        }
예제 #2
0
파일: Program.cs 프로젝트: Cserny/Tetris
        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);
        }