void SpriteState()
 {
     mouse = Input.GetMouse();
     spriteDialog.Update();
     if (spriteDialog.SaveButton.IsInside(mouse.X, mouse.Y))
     {
         spriteDialog.SaveButton.BorderColor = 12;
     }
     else
     {
         spriteDialog.SaveButton.BorderColor = 8;
     }
     if (spriteDialog.SaveButton.IsInside(mouse.X, mouse.Y) && mouse.IsLeftClick())
     {
         spriteDialog.SaveButton.BorderColor = 10;
     }
     if (spriteDialog.SaveButton.IsInside(mouse.X, mouse.Y) && mouse.IsLeftClick() || Input.GetKey(Key.Return).Pressed)
     {
         activeSprite.Save(spriteDialog.NameField.Text);
         stateValue = State.Standard;
     }
     else
     {
         if (Input.GetKey(Key.Escape).Pressed)
         {
             stateValue = State.Standard;
         }
     }
 }
 void PaletteState()
 {
     mouse = Input.GetMouse();
     paletteDialog.Update();
     if (paletteDialog.SaveButton.IsInside(mouse.X, mouse.Y))
     {
         paletteDialog.SaveButton.BorderColor = 12;
     }
     else
     {
         paletteDialog.SaveButton.BorderColor = 8;
     }
     if (paletteDialog.SaveButton.IsInside(mouse.X, mouse.Y) && mouse.IsLeftClick())
     {
         paletteDialog.SaveButton.BorderColor = 10;
     }
     if (paletteDialog.SaveButton.IsInside(mouse.X, mouse.Y) && mouse.IsLeftClick() || Input.GetKey(Key.Return).Pressed)
     {
         ColorChanger.GetPalette().Save(paletteDialog.NameField.Text);
         stateValue = State.Standard;
     }
     else
     {
         if (Input.GetKey(Key.Escape).Pressed)
         {
             stateValue = State.Standard;
         }
     }
 }
        void HandleInput()
        {
            var prevMouseX = mouse.X;
            var prevMouseY = mouse.Y;

            mouse = Input.GetMouse();
            if (Input.GetKey(Key.Escape).Pressed)
            {
                MyGame.ChangeStates(new InitialState(Parent, "Initial State"));
            }
            if (mouse.IsRightClick())
            {
                var MouseXDelta = mouse.X - prevMouseX;
                var MouseYDelta = mouse.Y - prevMouseY;

                spriteX += MouseXDelta;
                spriteY += MouseYDelta;
            }
            if (Input.GetKey(Key.LeftShift).Held)
            {
                if (scale + mouse.Z * Parent.DeltaTime < 1)
                {
                    scale = 1f;
                }
                else
                {
                    scale += mouse.Z * Parent.DeltaTime;
                }
            }
            else
            {
                colorValue.Value += mouse.Z;
            }
            var x = (int)((mouse.X - spriteX) * (1f / (scale * scale)));
            var y = (int)((mouse.Y - spriteY) * (1f / (scale * scale)));//why the f**k does this work?!?!?!?!?

            if (mouse.IsLeftClick())
            {
                activeSprite.SetChar(x, y, characterValue);
                activeSprite.SetColor(x, y, (byte)colorValue.Value);
            }
            cont--;
            if (colorValue.IsOnUp(mouse.X, mouse.Y) && mouse.IsLeftClick() && cont <= 0)
            {
                colorValue.Increment();
                cont = freq;
            }
            if (colorValue.IsOnDown(mouse.X, mouse.Y) && mouse.IsLeftClick() && cont <= 0)
            {
                colorValue.Decrement();
                cont = freq;
            }
            if (exportSprButton.IsInside(mouse.X, mouse.Y) && mouse.IsLeftClick())
            {
                stateValue = State.SpriteSave;
            }
            if (importPalButton.IsInside(mouse.X, mouse.Y) && mouse.IsLeftClick())
            {
                activeSprite = ConsoleSprite.Load("Test");
            }
            if (palettePanel.IsInside(mouse.X, mouse.Y) && mouse.IsLeftClick())
            {
                var xPos = Parent.Screen.Width - 12;
                var yPos = Parent.Screen.Height - 2;
                colorIndex          = (short)(mouse.X - (xPos) + (8 * (mouse.Y - yPos)));
                color               = ColorChanger.GetColor(colorIndex);
                colorWindow.color   = colorIndex;
                colorWindow.R.Value = color.R;
                colorWindow.G.Value = color.G;
                colorWindow.B.Value = color.B;
                stateValue          = State.ColorWindow;
            }
            for (int i = 0; i < components.Count; i++)
            {
                if (components[i].IsInside(mouse.X, mouse.Y))
                {
                    components[i].BorderColor = 12;
                }
                else
                {
                    components[i].BorderColor = 8;
                }
                if (components[i].Clickable && components[i].IsInside(mouse.X, mouse.Y) && mouse.IsLeftClick())
                {
                    components[i].BorderColor = 10;
                }
            }
            if (resetButton.IsInside(mouse.X, mouse.Y))
            {
                resetButton.BorderColor = 12;
            }
            else
            {
                resetButton.BorderColor = 8;
            }
            if (resetButton.IsInside(mouse.X, mouse.Y) && mouse.IsLeftClick())
            {
                resetButton.BorderColor = 10;
                ColorChanger.SetColor(0, Color.FromArgb(0, 0, 0));
                for (int i = 0; i < 16; i++)
                {
                    ColorChanger.SetColor(i, ColorChanger.StandardColors.colors[i]);
                }
            }
            if (exportPalButton.IsInside(mouse.X, mouse.Y) && mouse.IsLeftClick())
            {
                stateValue = State.PaletteSave;
            }
            if (importPalButton.IsInside(mouse.X, mouse.Y) && mouse.IsLeftClick())
            {
                ColorChanger.SetPalette(Palette.Load("TestPalette"));
            }
        }