Example #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();
            }
        }
Example #2
0
        static Picturebox LoadPicturebox(Stream fs)
        {
            var obj = new Picturebox(ReadString(fs), ReadImage(fs), ReadInt(fs), ReadInt(fs), ReadInt(fs), ReadInt(fs), ReadColor(fs), false,
                                     (BorderStyle)fs.ReadByte(), ReadScaleMode(fs))
            {
                Enabled  = ReadBool(fs),
                Visible  = ReadBool(fs),
                AutoSize = ReadBool(fs)
            };

            return(obj);
        }
Example #3
0
        /// <summary>
        /// Construct an instance of the GameManager
        /// </summary>
        /// <param name="surface">Bitmap that the GameManager will render the scene to</param>
        public GameManager(Bitmap surface, Picturebox host)
        {
            if (surface == null)
              throw new ArgumentNullException("surface");
              if (surface == null)
              throw new ArgumentNullException("host");

              Surface = surface;
              Host = host;
              Enabled = true;
              InputManager = new Input.InputManager();
              Game = this;
        }
Example #4
0
 public override void Draw(Bitmap surface, Picturebox host)
 {
     base.Draw(surface, host);
 }
Example #5
0
 /// <summary>
 /// Render the current animation frame to a Bitmap
 /// </summary>
 /// <param name="surface">Bitmap to render the frame onto</param>
 /// <param name="x">X location to render the frame</param>
 /// <param name="y">Y location to render the frame</param>
 public void Draw(Bitmap surface, Picturebox host, int x, int y)
 {
     Draw(surface, host, x, y, _currentFrame);
 }
Example #6
0
 private void Draw(Bitmap surface, Picturebox host, int x, int y, int index)
 {
     Rect r = _frames[index];
       surface.DrawImage(x, y, _texture, r.X, r.Y, r.Width, r.Height);
 }
Example #7
0
 public override void Draw(Bitmap surface, Picturebox host)
 {
     _animationSequences[CurrentAnimation].Draw(surface, host, X, Y);
 }
Example #8
0
 public PacmanGame(Bitmap surface, Picturebox host)
     : base(surface, host)
 {
     Level = 1;
 }
Example #9
0
 /// <summary>
 /// Render the GameObject to the surface Bitmap
 /// </summary>
 /// <param name="surface">Bitmap on which the GameObject will be rendered</param>
 public virtual void Draw(Bitmap surface, Picturebox host)
 {
 }
Example #10
0
 public override void Draw(Bitmap surface, Picturebox host)
 {
     surface.DrawImage(0, 0, _cache, 0, 0, 320, 240);
       if (_bonusItem != BonusItemType.None)
       {
     surface.DrawImage(112, 144, _mazeSpriteSheet,
       _bonusItemRect.X, _bonusItemRect.Y,
       _bonusItemRect.Width, _bonusItemRect.Height);
       }
 }
Example #11
0
 public override void Draw(Bitmap surface, Picturebox host)
 {
     if (!Active)
       return;
       base.Draw(surface, host);
 }
Example #12
0
        private void ZombieHealthMonitorForm()
        {
            var frm = new Form("zombie health monitor");

            // 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 Health Monitor", _fntHuge, frm.Width / 2 - 140, 30) { Color = Gadgeteer.Color.Yellow };
            pnl.AddControl(title);

            // Add Heart Rate Graph.
            var graph = new Picturebox("heartRateGraph", null, 100, 200, 600, 200);
               pnl.AddControl(graph);

            TinkrCore.ActiveContainer = frm;
        }