Exemplo n.º 1
0
        public void Initialize(WireframeEditControl wireframeEditControl)
        {
            try
            {
                mWireframeEditControl = wireframeEditControl;

                mWireframeEditControl.ZoomChanged += HandleZoomChanged;

                Renderer.Self.Initialize(GraphicsDevice, null);

                Renderer.Self.SamplerState = SamplerState.PointWrap;

                LoaderManager.Self.ContentLoader = new ContentLoader();

                LoaderManager.Self.Initialize(null, "content/TestFont.fnt", Services, null);
                CameraController.Self.Initialize(Camera, mWireframeEditControl, Width, Height);

                InputLibrary.Cursor.Self.Initialize(this);
                InputLibrary.Keyboard.Self.Initialize(this);

                mScreenBounds = new LineRectangle();
                mScreenBounds.Width = 800;
                mScreenBounds.Height = 600;
                mScreenBounds.Color = ScreenBoundsColor;
                ShapeManager.Self.Add(mScreenBounds, SelectionManager.Self.UiLayer);

                this.KeyDown += OnKeyDown;
                this.KeyPress += OnKeyPress;
                this.MouseDown += CameraController.Self.HandleMouseDown;
                this.MouseMove += CameraController.Self.HandleMouseMove;
                this.MouseWheel += CameraController.Self.HandleMouseWheel;
                this.mTopRuler = new Ruler(this, null, InputLibrary.Cursor.Self);
                mLeftRuler = new Ruler(this, null, InputLibrary.Cursor.Self);
                mLeftRuler.RulerSide = RulerSide.Left;

                if (AfterXnaInitialize != null)
                {
                    AfterXnaInitialize(this, null);
                }

                UpdateToProject();

                mHasInitialized = true;

                SystemManagers.Default = SystemManagers.CreateFromSingletons();
            }
            catch(Exception exception)
            {
                MessageBox.Show("Error initializing the wireframe control\n\n" + exception);
            }
        }
Exemplo n.º 2
0
        public void Initialize(WireframeEditControl wireframeEditControl, Panel wireframeParentPanel)
        {
            try
            {
                mWireframeEditControl = wireframeEditControl;



                mWireframeEditControl.ZoomChanged += HandleZoomChanged;

                SystemManagers.Default = new SystemManagers();
                SystemManagers.Default.Initialize(GraphicsDevice);

                Renderer.Self.SamplerState = SamplerState.PointWrap;

                LoaderManager.Self.ContentLoader = new ContentLoader();

                LoaderManager.Self.Initialize(null, "content/TestFont.fnt", Services, null);
                CameraController.Self.Initialize(Camera, mWireframeEditControl, Width, Height);
                CameraController.Self.CameraChanged += () => CameraChanged?.Invoke();

                InputLibrary.Cursor.Self.Initialize(this);
                InputLibrary.Keyboard.Self.Initialize(this);

                mScreenBounds        = new LineRectangle();
                mScreenBounds.Name   = "Gum Screen Bounds";
                mScreenBounds.Width  = 800;
                mScreenBounds.Height = 600;
                mScreenBounds.Color  = ScreenBoundsColor;
                ShapeManager.Self.Add(mScreenBounds, SelectionManager.Self.UiLayer);

                this.KeyDown    += OnKeyDown;
                this.MouseDown  += CameraController.Self.HandleMouseDown;
                this.MouseMove  += CameraController.Self.HandleMouseMove;
                this.MouseWheel += CameraController.Self.HandleMouseWheel;
                this.mTopRuler   = new Ruler(this, null, InputLibrary.Cursor.Self, InputLibrary.Keyboard.Self);

                this.MouseEnter += (not, used) =>
                {
                    System.Diagnostics.Debug.WriteLine("Entered");
                    mouseHasEntered = true;
                };
                this.MouseLeave += (not, used) =>
                {
                    System.Diagnostics.Debug.WriteLine("Left");

                    mouseHasEntered = false;
                };

                mLeftRuler           = new Ruler(this, null, InputLibrary.Cursor.Self, InputLibrary.Keyboard.Self);
                mLeftRuler.RulerSide = RulerSide.Left;

                if (AfterXnaInitialize != null)
                {
                    AfterXnaInitialize(this, null);
                }

                UpdateToProject();

                mHasInitialized = true;
            }
            catch (Exception exception)
            {
                MessageBox.Show("Error initializing the wireframe control\n\n" + exception);
            }
        }