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); }
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(); }