예제 #1
0
파일: Program.cs 프로젝트: iq110/BattleCity
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

//            Game screen size
//            int x = 40 * 15;
//            int y = 40 * 15;
//
//            BattleCity view = new BattleCity(x,y);
            BattleCity view       = new BattleCity();
            Logic      model      = new Logic();
            Controller controller = new Controller(view, model, "Player 0");


            Application.Run(view);
        }
예제 #2
0
        public Controller(BattleCity view, Logic logic, string playerName)
        {
            _view  = view;
            _logic = logic;

            //Give to Logic screen size of View
            _logic.SetScreenWidht(_view.GetScreenWidht());
            _logic.SetScreenHeight(_view.GetScreenHeight());

            //do subscriptions
            _view.KeyPressed   += GetPressedKeyFromView;
            _view.KeyUnpressed += GetUnpressedKeyFromView;
            _view.RedrawMap    += RedrawMap;
            _view.MouseMoved   += GetMousePosition;
            //init player
            _playerId = _logic.CreatePlayer(playerName);
            _logic.InitRobots();
        }