Ejemplo n.º 1
0
        public static void Update()
        {
            if (Game1.EditorMenuOpen == true)
            {
                EditorMenu.Update();
            }
            else
            {
                if (MouseInput.MouseStateOld.LeftButton == ButtonState.Pressed)
                {
                    if (UIDrawing.Instance.Tiles.SelectedIndex != null || UIDrawing.Instance.TilesPhysics.SelectedIndex != null)
                    {
                        DrawOnBackground(SelectedEditTile);
                    }
                }
                if (MouseInput.MouseStateNew.MiddleButton == ButtonState.Pressed)
                {
                    Camera2DEditor.MoveBy(MouseInput.MouseStateNew.Position.ToVector2() - MouseInput.MouseStateOld.Position.ToVector2());
                }
                if (MouseInput.MouseStateOld.RightButton == ButtonState.Pressed)
                {
                    DrawOnBackground("_blank_");
                }
                if (MouseInput.MouseClickedLeft() == true)
                {
                    if (UIEntities.Instance.Entities.SelectedIndex != null)
                    {
                        if (UIEntities.Instance.Entities.SelectedIndex == 0)
                        {
                            AddPlayer(new Vector2(MouseInput.MousePositionRealGrid().X, MouseInput.MousePositionRealGrid().Y - (62 * 2)));
                        }
                        if (UIEntities.Instance.Entities.SelectedIndex == 1)
                        {
                            AddEntity(new Vector2(MouseInput.MousePositionRealGrid().X, MouseInput.MousePositionRealGrid().Y - (194)));
                        }
                    }
                }
            }

            if (KeyboardInput.KeyboardStateNew.IsKeyUp(Keys.Tab) && KeyboardInput.KeyboardStateOld.IsKeyDown(Keys.Tab))
            {
                Game1.EditorMenuOpen = !Game1.EditorMenuOpen;
            }
        }