コード例 #1
0
ファイル: WindowRouter.cs プロジェクト: DrewCutch/SpellSword
        public void OnMouseMove(Coord last, Coord current)
        {
            PaneBounds from = GetTopPaneBounds(last);
            PaneBounds to   = GetTopPaneBounds(current);

            from?.Pane.OnMouseMove(last - from.Bounds.MinExtent, current - from.Bounds.MinExtent);

            if (!to.Equals(from))
            {
                to?.Pane.OnMouseMove(last - to.Bounds.MinExtent, current - to.Bounds.MinExtent);
            }
        }
コード例 #2
0
        public void HandleInput()
        {
            while (Terminal.HasInput())
            {
                int input = Terminal.Read();

                if (input == Terminal.TK_MOUSE_LEFT)
                {
                    PaneBounds     target   = GetTopPaneBounds(MousePos());
                    IInputListener newFocus = target.Pane.Focus(MousePos());

                    _windowListeners[target] = newFocus;

                    if (newFocus != _focus)
                    {
                        _focus.LoseFocus();
                        _focus = newFocus;
                    }

                    target.Pane.OnMouseClick(MousePos());
                }
                else if (input == Terminal.TK_MOUSE_MOVE)
                {
                    _windowListeners.Keys.Last().Pane.OnMouseMove(_mouseLast, MousePos());
                    _mouseLast = MousePos();
                }
                else if (input < Terminal.TK_MOUSE_LEFT) // All key presses
                {
                    if (_gameControlConsumer.Consume(input))
                    {
                        continue;
                    }

                    if ((input & Terminal.TK_KEY_RELEASED) == Terminal.TK_KEY_RELEASED)
                    {
                        _focus.OnKeyUp(input);
                    }
                    else
                    {
                        _focus.OnKeyDown(input);
                    }
                }
            }
        }
コード例 #3
0
ファイル: WindowRouter.cs プロジェクト: DrewCutch/SpellSword
 protected bool Equals(PaneBounds other)
 {
     return(Equals(Pane, other.Pane) && Bounds.Equals(other.Bounds));
 }
コード例 #4
0
ファイル: WindowRouter.cs プロジェクト: DrewCutch/SpellSword
        public IInputListener Focus(Coord pos)
        {
            PaneBounds target = GetTopPaneBounds(pos);

            return(target?.Pane.Focus(pos - target.Bounds.MinExtent) ?? this);
        }
コード例 #5
0
ファイル: WindowRouter.cs プロジェクト: DrewCutch/SpellSword
        public void OnMouseClick(Coord pos)
        {
            PaneBounds target = GetTopPaneBounds(pos);

            target?.Pane.OnMouseClick(pos - target.Bounds.MinExtent);
        }
コード例 #6
0
 protected bool Equals(PaneBounds other)
 {
     return(Equals(Pane, other.Pane));
 }