Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 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;
        }