public MainForm()
        {
            InitializeComponent();
            WinApi.TimeBeginPeriod(1);

            _codeCompiler = new CodeCompiler(SynchronizationContext.Current);
            _codeCompiler.Compiled += CodeCompilerOnCompiled;
            _codeCompiler.CompilationError += CodeCompilerOnCompilationError;

            SettingsForm.Instance.StoreLastFramesParamChanged += SettingsFormOnStoreLastFramesParamChanged;

            _graphics = new GraphicsControl();
            elementHost1.Child = _graphics;
            _graphics.KeyDown += GraphicsOnKeyDown;
            _graphics.KeyUp += GraphicsOnKeyUp;

            codeEditor.Text = CodeSnippets.HelloWorld;
            codeEditor.TextChanged += CodeEditorOnTextChanged;

            _dynamicGame = new DynamicGame(_graphics, toolStripStatusLabel1)
            {
                CurrentTrackBarValue = trackBar1.Value
            };
            _dynamicGame.CurrentTrackBarValueChanged += DynamicGameOnCurrentTrackBarValueChanged;
            _dynamicGame.FieldsChanged += DynamicGameOnFieldsChanged;
            _dynamicGame.PausedChanged += DynamicGameOnPausedChanged;
            _graphics.MouseDown += (sender, args) => _graphics.Focus();

            UpdateFormTitle();
        }
        /// <summary>
        ///     Initializes a new instance of the DynamicGame class.
        /// </summary>
        public DynamicGame(GraphicsControl g, ToolStripStatusLabel logLabel)
        {
            g.DrawingFunc = DrawScene;
            GraphicsControl = g;
            _dynamicGameSimulator = new DynamicGameSimulator(this);

            for (int i = 'A'; i <= 'Z'; i += 1)
            {
                _input[(char) i] = false;
            }
            _logLabel = logLabel;
        }