public View(Model model, Controller controller) : base() { this.model = model; this.controller = controller; model.ModelUpdateEvent += new Model.ViewUpdater(this.update); this.Width = 800; this.Height = 500; g = this.CreateGraphics(); }
public GameView(Model model, Controller controller) : base(model, controller) { this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true); Application.ApplicationExit += new EventHandler(MemoryCleanup); GraphicManager = BufferedGraphicsManager.Current; GraphicManager.MaximumBuffer = new Size(this.Width + 1, this.Height + 1); ManagedBackBuffer = GraphicManager.Allocate(this.CreateGraphics(), ClientRectangle); ManagedBackBuffer.Graphics.SmoothingMode = SmoothingMode.HighQuality; ManagedBackBuffer.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; }
public void createController() { this.currentController = new Controller(this); // register the key event handler to controller //currentView.KeyUp += new System.Windows.Forms.KeyEventHandler(currentController.keyUpHandler); currentView.KeyDown += new System.Windows.Forms.KeyEventHandler(currentController.keyDownHandler); }