コード例 #1
0
ファイル: Program.cs プロジェクト: Arthurshultz/Practice-2019
        static void Main(string[] arg)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // default
            GameModel   _gameModel  = new GameModel();
            IController _controller = new PackmanController(_gameModel);
            ViewForm    _viewForm   = new ViewForm(_controller, _gameModel);

            if (arg.Length == 5)
            {
                try
                {
                    _gameModel  = new GameModel(int.Parse(arg[0]), int.Parse(arg[1]), int.Parse(arg[2]), int.Parse(arg[3]), int.Parse(arg[4]));
                    _controller = new PackmanController(_gameModel);
                    _viewForm   = new ViewForm(_controller, _gameModel, int.Parse(arg[0]), int.Parse(arg[1]));
                }
                catch
                {
                    // doing something
                }
            }

            Application.Run(_viewForm);
        }
コード例 #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            GameView          gameView   = new GameView();
            Model             model      = new Model();
            PackmanController controller = new PackmanController(gameView, model);

            gameView.ShowDialog();
        }
コード例 #3
0
        public FormMain(PackmanController controller, ListEntities entities, int mapWidth, int mapHeight)
        {
            InitializeComponent();
            Controller = controller;
            Entities   = entities;
            MapWidth   = mapWidth;
            MapHeight  = mapHeight;


            controller.NewGame();

            map      = new Bitmap(MapWidth, MapHeight);
            graphics = Graphics.FromImage(map);
            Draw();
        }
コード例 #4
0
        static void Main()
        {
            int mapWidth  = 800;
            int mapHeight = 500;

            MovableObject.speed = 3;
            int maxAppleCount = 5;
            int maxTankCount  = 5;

            ListEntities      entities   = new ListEntities();
            GameModel         gameModel  = new GameModel(mapWidth, mapHeight, entities, maxAppleCount, maxTankCount);
            PackmanController controller = new PackmanController(gameModel);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormMain(controller, entities, mapWidth, mapHeight));
        }
コード例 #5
0
 public void SetController(PackmanController givenController)
 {
     controller = givenController;
 }