예제 #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="blockGridObject"></param>
        public TriadGame(BlockGrid blockGridObject)
        {
            if (blockGridObject == null)
            {
                throw new ArgumentNullException("blockGridObject");
            }
            this.topBlock = new Block();
            this.middleBlock = new Block();
            this.bottomBlock = new Block();
            this.blockGrid = blockGridObject;

            int startColumn = blockGrid.GridSize.Width / 2;
            this.X = startColumn * Block.BlockWidth;
            this.Y = 0;
        }
예제 #2
0
        /// <summary>
        /// 
        /// </summary>
        public void Go()
        {
            if (File.Exists(fileName))
            {
                filePath = "";
                fileDirectory = "";
            }
            else if (File.Exists(Path.Combine(fileDirectory, fileName)))
            {
                filePath = "";
            }

            int width = 800;
            int height = 600;

            Video.WindowIcon();
            Video.WindowCaption = "SDL.NET - Triad";
            Events.KeyboardDown +=
                new EventHandler<KeyboardEventArgs>(this.KeyboardDown);
            Events.KeyboardUp +=
                new EventHandler<KeyboardEventArgs>(this.KeyboardUp);
            Events.Tick += new EventHandler<TickEventArgs>(this.Tick);
            Events.Quit += new EventHandler<QuitEventArgs>(this.Quit);

            board = new Scoreboard();
            board.X = 600;
            board.Y = 0;
            board.Size = new Size(200, 400);
            screen =
                    Video.SetVideoMode(width, height);
            surf =
                screen.CreateCompatibleSurface(width, height);
            surf.Fill(
                new Rectangle(new Point(0, 0), surf.Size), Color.Black);


            grid = new BlockGrid(new Point(20, 20), new Size(11, 13));
            grid.BlocksDestroyed +=
                new EventHandler<BlocksDestroyedEventArgs>(grid_BlocksDestroyed);
            levelUpSound = Mixer.Sound(Path.Combine(Path.Combine(filePath, fileDirectory), "levelup.wav"));
            Events.Run();
        }