Пример #1
0
        /// <summary>
        /// The mouse.
        /// </summary>
        /// <param name="mouse"></param>
        public GuiPointer(GuiManager manager,
                          EventProcessor processor, Style style,
                          IGuiRenderer renderer, Sensitivity sensitivity)
        {
            this.manager     = manager;
            this.mouse       = processor.EventPump.PrimaryMouse;
            this.sensitivity = sensitivity;
            this.style       = style;
            this.renderer    = renderer;


            processor.MouseButtonDown += ButtonDown;
            processor.MouseButtonUp   += ButtonUp;
            processor.MouseAxis       += MouseAxis;
            processor.CursorMoved     += CursorMove;

            // We fire mouse enter event immediatelly.
            interactive.OnPointerEnter(this);
        }
Пример #2
0
        /// <summary>
        /// Input router constructor.
        /// </summary>
        public InputRouter([NotNull] GuiManager manager,
                           [NotNull] EventProcessor processor, Style style,
                           IGuiRenderer pointerRenderer, Sensitivity sensitivity)
        {
            if (sensitivity == null)
            {
                sensitivity = new Sensitivity();
            }

            this.processor   = processor;
            this.manager     = manager;
            this.sensitivity = sensitivity;

            processor.KeyDown += KeyDown;
            processor.KeyUp   += KeyUp;


            this.pointer = new GuiPointer(manager, processor,
                                          style, pointerRenderer, sensitivity);
            manager.AddNLObject(pointer);
        }