예제 #1
0
        public override bool ProcessMouse(MouseScreenObjectState state)
        {
            mouse.Update(state, IsMouseOver);
            if (state.IsOnScreenObject)
            {
                //If the mouse enters the screen held but the hold started from outside the screen, we ignore it
                var(x, y) = state.SurfaceCellPosition;
                var colors = colorPicker.colors;
                if (state.Mouse.LeftButtonDown && mouse.leftPressedOnScreen)
                {
                    model.brush.foreground      = colors[x, y];
                    colorPicker.foregroundPoint = new Point(x, y);

                    colorPicked?.Invoke();
                }
                if (state.Mouse.RightButtonDown && mouse.rightPressedOnScreen)
                {
                    model.brush.background      = colors[x, y];
                    colorPicker.backgroundPoint = new Point(x, y);

                    colorPicked?.Invoke();
                }
            }

            return(base.ProcessMouse(state));
        }
예제 #2
0
        public override bool ProcessMouse(MouseScreenObjectState state)
        {
            mouse.Update(state, IsMouseOver);
            if (state.IsOnScreenObject)
            {
                int index = (state.SurfaceCellPosition.X) + (state.SurfaceCellPosition.Y * Width);
                if (index > -1 && index < paletteModel.palette.Count)
                {
                    var left  = mouse.leftPressedOnScreen && mouse.nowLeft;
                    var right = mouse.rightPressedOnScreen && mouse.nowRight;
                    if (left || right)
                    {
                        if (left)
                        {
                            if (paletteModel.foregroundIndex != index)
                            {
                                //Don't want the color to flash between index and transparent
                                if (mouse.left == ClickState.Pressed || (mouse.left == ClickState.Held && paletteModel.foregroundIndex != null))
                                {
                                    paletteModel.foregroundIndex = index;
                                    spriteModel.brush.foreground = paletteModel.palette[index];
                                }
                            }
                            else if (mouse.left == ClickState.Pressed)
                            {
                                //Press the same color to deselect
                                paletteModel.foregroundIndex = null;
                                spriteModel.brush.foreground = Color.Transparent;
                            }
                        }
                        if (right)
                        {
                            if (paletteModel.backgroundIndex != index)
                            {
                                //Don't want the color to flash between index and transparent
                                if (mouse.right == ClickState.Pressed || (mouse.right == ClickState.Held && paletteModel.backgroundIndex != null))
                                {
                                    paletteModel.backgroundIndex = index;
                                    spriteModel.brush.background = paletteModel.palette[index];
                                }
                            }
                            else if (mouse.right == ClickState.Pressed)
                            {
                                //Press the same color to deselect
                                paletteModel.backgroundIndex = null;
                                spriteModel.brush.background = Color.Transparent;
                            }
                        }

                        brushChanged?.Invoke();
                    }
                }
            }

            return(base.ProcessMouse(state));
        }
 public override bool ProcessMouse(MouseScreenObjectState state)
 {
     mouse.Update(state, IsMouseOver);
     if (IsMouseOver)
     {
         if (mouse.leftPressedOnScreen && mouse.left == ClickState.Released)
         {
             click();
         }
     }
     return(base.ProcessMouse(state));
 }
예제 #4
0
        public override bool ProcessMouse(MouseScreenObjectState state)
        {
            mouse.Update(state, IsMouseOver);
            if (state.IsOnScreenObject && state.Mouse.LeftButtonDown && mouse.leftPressedOnScreen)
            {
                int index = (state.SurfaceCellPosition.X) + (state.SurfaceCellPosition.Y * Width);
                if (index < 256 && spriteModel.brush.glyph != index)
                {
                    spriteModel.brush.glyph = (char)index;
                    brushChanged?.Invoke();
                }
            }

            return(base.ProcessMouse(state));
        }
예제 #5
0
 public override bool ProcessMouse(MouseScreenObjectState state)
 {
     var(x, y) = state.SurfaceCellPosition;
     if (state.IsOnScreenObject)
     {
         mouse.Update(state, IsMouseOver);
         if (state.Mouse.LeftButtonDown && mouse.leftPressedOnScreen)
         {
             index           = x;
             colorPicker.hue = index * 360d / bar.Length;
             colorPicker.UpdateColors();
             colorPicker.UpdateBrushPoints(paletteModel);
             colorPicker.UpdatePalettePoints(paletteModel);
         }
     }
     return(base.ProcessMouse(state));
 }
예제 #6
0
        public override bool ProcessMouse(MouseScreenObjectState state)
        {
            int deltaScroll = state.Mouse.ScrollWheelValueChange / 60;

            if (deltaScroll != 0)
            {
                scroll.index += deltaScroll;
                UpdateListing();
            }
            mouse.Update(state, IsMouseOver);
            if (mouse.left == ClickState.Held && mouse.leftPressedOnScreen)
            {
                var deltaY = mouse.prevPos.Y - mouse.nowPos.Y;
                if (deltaY != 0)
                {
                    scroll.index += deltaY;
                }
            }

            return(base.ProcessMouse(state));
        }