示例#1
0
文件: Form1.cs 项目: punker76/PacMan
        public Form1()
        {
            InitializeComponent();

            var soundSet = new SoundSet();

            _game = Game.Game.Create()
                    .Subscribe(GameNotification.Beginning, soundSet.Beginning)
                    .Subscribe(GameNotification.EatCoin, soundSet.Chomp)
                    .Subscribe(GameNotification.Respawning, soundSet.Death)
                    .Subscribe(GameNotification.EatFruit, soundSet.EatFruit)
                    .Subscribe(GameNotification.EatGhost, soundSet.EatGhost)
                    .Subscribe(GameNotification.ExtraPac, soundSet.ExtraPac)
                    .Subscribe(GameNotification.Intermission, soundSet.Intermission)
                    .StartGame();

            _graphicsBuffers = new GraphicsBuffers(this)
            {
                ShowFps = true
            };

            this.StartPosition = FormStartPosition.CenterScreen;
            this.Text          = "PacMan";
            this.WindowState   = FormWindowState.Maximized;
            this.KeyDown      += Form1_KeyDown;

            _renderLoop.Interval = 16; //40fps
            _renderLoop.Enabled  = true;
            _renderLoop.Tick    += _renderLoop_Tick;
        }
示例#2
0
        public Form1(string[] args)
        {
            InitializeComponent();

            _game = Game.Game.Create()
                    .AddKeyboard()
                    .AddSounds()
                    .AddBots(args)
                    .StartGame();

            _graphicsBuffers = new GraphicsBuffers(this)
            {
                ShowFps = true
            };

            this.StartPosition = FormStartPosition.CenterScreen;
            this.Text          = "PacMan";
            this.WindowState   = FormWindowState.Maximized;

            _renderLoop.Interval = 16; //40fps
            _renderLoop.Enabled  = true;
            _renderLoop.Tick    += _renderLoop_Tick;
        }