public MainForm(int fieldWidth, int fieldHeight, int tanksAmount, int applesAmount, int objectsSpeed) { InitializeComponent(); if ((fieldWidth >= 250) && (fieldWidth <= 770)) { _fieldWidth = fieldWidth; } else { _fieldWidth = 250; } if ((fieldHeight >= 250) && (fieldHeight <= 300)) { _fieldHeight = fieldHeight; } else { _fieldHeight = 250; } if ((tanksAmount >= 10) && (tanksAmount <= 1)) { _tanksAmount = tanksAmount; } else { _tanksAmount = 5; } if ((applesAmount >= 10) && (applesAmount <= 1)) { _applesAmount = applesAmount; } else { _applesAmount = 5; } if ((objectsSpeed >= 10) && (objectsSpeed <= 1)) { _objectsSpeed = objectsSpeed; } else { _objectsSpeed = 10; } model = new Model(_fieldWidth, _fieldHeight, _tanksAmount, _applesAmount, _objectsSpeed); pictureBox1.Size = new Size(_fieldWidth, _fieldHeight); packmanController = new PackmanController(model); timer.Interval = _objectsSpeed; timer.Tick += new EventHandler(Timer_Tick); drawing = new Drawing(pictureBox1, model); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); GameField gameField = new GameField(new Size(700, 700), 400, 5, 5); GameFieldView gameFieldView = new GameFieldView(gameField, gameField.SizeField); PackmanController packmanController = new PackmanController(gameField, gameFieldView); Application.Run(gameFieldView.MainForm); }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); GameDirector gameDirector = new GameDirector(); MainForm mainForm = new MainForm(); FieldCreator fieldCreator = new FieldCreator(args); PackmanController packmanController = new PackmanController(mainForm, gameDirector, fieldCreator); Application.Run(mainForm); }
public GameForm() { InitializeComponent(); MaxX = p_Map.Width; MaxY = p_Map.Height; for (int i = 0; i < map.Length; i++) { for (int j = 0; j < map[0].Length; j++) { countWall += map[i][j] == '1' ? 1 : 0; countRiver += map[i][j] == '2' ? 1 : 0; } } modelGame = new Game(); packmanController = new PackmanController(modelGame); AddElementsViews(); SubscribeKeyPress(); }
public GameForm(int width, int height, int tanksValue, int appleValue) { this.width = width - width % 15; this.height = height - height % 15; InitializeComponent(); controller = new PackmanController(); ClientSize = new Size(this.width, this.height + 30); MinimumSize = new Size(this.width + 16, this.height + 69); GameMapPictureBox.Size = new Size(this.width, this.height); GameMapPictureBox.Location = new Point(0, 30); timer.Interval = 50; timer.Tick += ViewLoop; controller.Initial(tanksValue, appleValue, GameMapPictureBox.Size); GameMapPictureBox.Image = controller.GetNextBitmap(GameMapPictureBox.Size); informationForm = new InformationForm(controller.GetInformationSource()); }
public void SetController(PackmanController controller) { packmanController = controller; }