Beispiel #1
0
        public void Main(string ApplicationPath, string[] Args)
        {
            Form frmPacman = new Form("frmPacman");
            frmPacman.ButtonPressed += frmPacman_ButtonPressed;

            Bitmap bmpGame;
            Picturebox pbGame;

            bmpGame = new Bitmap(320, 240);

            if (Prompt.Show("Resolution Adjust", "Would you like to play at 640x480?", Fonts.Calibri18Bold, Fonts.Calibri14, PromptType.YesNo) == PromptResult.Yes)
            {
                pbGame = new Picturebox("pbGame", bmpGame, frmPacman.Width / 2 - 320, frmPacman.Height / 2 - 240, 640, 480, BorderStyle.BorderNone);
                pbGame.ScaleMode = ScaleMode.Stretch;
            }
            else
                pbGame = new Picturebox("pbGame", bmpGame, frmPacman.Width / 2 - 160, frmPacman.Height / 2 - 140, BorderStyle.BorderNone);

            pbGame.Background = Colors.Black;
            game = new PacmanGame(bmpGame, pbGame);
            frmPacman.AddControl(pbGame);

            Graphics.ActiveContainer = frmPacman;

            Thread.Sleep(100);
            if (joystick != null)
            {
                game.InputManager.AddInputProvider(joystick);
                game.Initialize();
            }
        }
Beispiel #2
0
        private void ZombieDistractorForm()
        {
            const int gameWidth = 320;
            const int gameHeight = 240;

            var frm = new Form("zombie distractor");

            // Add panel
            var pnl = new Skewworks.Tinkr.Controls.Panel("pnl1", 0, 0, 800, 480);
            pnl.BackgroundImage = Resources.GetBitmap(Resources.BitmapResources.Zombies);
            frm.AddControl(pnl);

            // Add the app bar.
            pnl.AddControl(BuildAppBar(frm.Name));

            // Add a title.
            var title = new Label("lblTitle", "Zombie Distractor", _fntHuge, frm.Width / 2 - 140, 30) { Color = Gadgeteer.Color.Yellow };
            pnl.AddControl(title);

            TinkrCore.ActiveContainer = frm;

            // Add Pacman.
            var surface = TinkrCore.Screen;
            _pacmanGame = new PacmanGame(surface, frm.Width/2 - gameWidth/2, frm.Height/2 - gameHeight/2);
            _pacmanGame.InputManager.AddInputProvider(new GhiJoystickInputProvider(joystick));
            _pacmanGame.Initialize();
        }