Пример #1
0
        // World is a simple container for Players and Powerups
        // The controller owns the world, but we have a reference to it
        //private World theWorld;

        public GameView(GameController c)
        {
            InitializeComponent();
            controller = c;
            //registering events that need to happen as soon as they are called on by the controller.
            controller.Connected       += getViewName;
            controller.MessagesArrived += OnFrame;
            ClientSize                = new Size(800, 800);
            drawingPanelGame          = new DrawingPanel.DrawingPanel();
            drawingPanelGame.Location = new Point(0, 0);
            drawingPanelGame.Size     = new Size(this.ClientSize.Width, this.ClientSize.Height);
            drawingPanelGame.Anchor   = AnchorStyles.Bottom;
            drawingPanelGame.Enabled  = false;
            this.Controls.Add(drawingPanelGame);
        }
Пример #2
0
 /// <summary>
 /// this constructor for the form, iniiialized all the form components and adds the panel on the form
 /// </summary>
 public Form1()
 {
     InitializeComponent();
     //game controller referce
     gameController = new GameController.GameController();
     gameController.registerNetwork1(formNetwork);
     gameController.RegisterFrame(refreshPanel);
     gameController.RegisterEvent(append);
     gameController.RegisterClose(close);
     //making a panel for the world
     panel          = new DrawingPanel.DrawingPanel(gameController.GetWorld());
     panel.Location = new System.Drawing.Point(0, 40);
     //defualting the panel size to the max, will be later adjusted to the user
     panel.Size = new System.Drawing.Size(2000, 2000);
     //adding control inputs to the panel
     this.Controls.Add(panel);
 }