Пример #1
0
        public Main()
        {
            InitializeComponent();
            CreatePlayground();

            Load += (s, e) =>
            {
                _context = new GraphicContext();
                _context.Reset(_bitmap);
                _projectors.AddRange(AssemblyExtensions.FindAllImplementationsAndActivate <IProjectorEngine>());

                _projectors.InitializeAll(_context);

                _extensions.AddRange(AssemblyExtensions.FindAllImplementationsAndActivate <IGraphicExtension>());

                _projectors.Use <PerspectiveProjectorEngine>();
                BindExtensionControls();
                InitModelAndFrameTick();
            };

            playground.MouseWheel += CG_MouseWheel;
            playground.KeyPress   += Main_KeyPress;
            playground.Paint      += (s, e) => e.Graphics.DrawImage(_bitmap, 0, 0);
            _testOutputBuilder     = new StringBuilder();
            _testOutputWriter      = new StringWriter(_testOutputBuilder);
        }
Пример #2
0
 private void CreatePlayground()
 {
     _bitmap?.Dispose();
     _context?.Graphics?.Dispose();
     if (!ValidateGraphics())
     {
         return;
     }
     _bitmap = new Bitmap(playground.Bounds.Width, playground.Bounds.Height);
     _context?.Reset(_bitmap);
 }