public AxisBinding(InputComponent input, List <Axis> axes, List <Keys> posKeys, List <Keys> negKeys)
     : base(input)
 {
     this.axes    = axes;
     this.posKeys = posKeys;
     this.negKeys = negKeys;
 }
 public SinglePressBinding(InputComponent input, List <Keys> keys, List <Buttons> buttons, InputComponent.MouseButton?mouseButton)
     : base(input)
 {
     this.keys        = keys;
     this.buttons     = buttons;
     this.mouseButton = mouseButton;
 }
Exemplo n.º 3
0
 /**
  * desc here
  *
  * @param paramsdeschere
  *
  * @return returndeschere
  */
 public AxisBinding(InputComponent input, AxisEvent[] axes, ButtonEvent[] pos, ButtonEvent[] neg)
     : base(input)
 {
     this.axes = axes;
     this.pos  = pos;
     this.neg  = neg;
 }
Exemplo n.º 4
0
        //Obtains the clicked item, calls that items click handler, and sets focus.
        private void handleClick(MouseKeyBinding.MouseButton button)
        {
            if (items == null)
            {
                return;
            }

            //Find the last (top) clicked item
            InputComponent ic          = graphics.engine.inputComponent;
            Vector2        pos         = ic.getMousePosition();
            GUIItem        clickedItem = getItemAt(pos);

            if (clickedItem != null)
            {
                clickedItem.handleMouseDown(pos, button);
            }

            //Set Focus
            if (focused != null)
            {
                focused.onBlur();
            }
            if (clickedItem == null || clickedItem.focusable)
            {
                focused = clickedItem;
            }
            if (focused != null)
            {
                focused.onFocus();
            }
        }
Exemplo n.º 5
0
        private void handleClickUp(MouseKeyBinding.MouseButton m)
        {
            InputComponent ic  = graphics.engine.inputComponent;
            Vector2        pos = ic.getMousePosition();

            if (focused != null)
            {
                focused.handleMouseUp(pos, m);
            }
        }
        /**
         * Constructor. Constructs all engine components.
         */
        public MirrorEngine(string gameTitle = "Mirror Engine")
        {
            resourceComponent = new ResourceComponent(this);
            inputComponent    = new InputComponent(this);
            physicsComponent  = new PhysicsComponent(this);
            graphicsComponent = new GraphicsComponent(this);
            audioComponent    = new AudioComponent(this);
            editorComponent   = new EditorComponent(this);

            this.gameTitle = gameTitle;
        }
Exemplo n.º 7
0
        /**
         * desc here
         *
         * @param paramsdeschere
         *
         * @return returndeschere
         */
        public Tool(EditorComponent editor)
        {
            this.editor = editor;

            InputComponent input = this.editor.engine.inputComponent;

            toolAction = new Stack <ToolAction>();
            undos      = new Stack <ToolAction>();

            toolButton = new GUIButton(editor.editorGui, null, null);
            toolButton.mouseClickEvent += (pos, button) => { editor.selectTool(this); };
            toolButton.mouseUpEvent    += (pos, button) => { toolButton.texture = this.active ? toolButton.pressedImg : toolButton.unpressedImg; };
        }
Exemplo n.º 8
0
        public virtual void initialize()
        {
            InputComponent ic    = graphics.engine.inputComponent;
            object         saved = ic.getContext(typeof(InputComponent.GUIBindings));

            ic.setContext(typeof(InputComponent.GUIBindings), this);
            (ic[InputComponent.GUIBindings.MOUSEBUTTON] as MouseKeyBinding).mouseKeyDown += handleClickDown;
            (ic[InputComponent.GUIBindings.MOUSEBUTTON] as MouseKeyBinding).mouseKeyUp   += handleClickUp;

            (ic[InputComponent.GUIBindings.TEXT] as TextBinding).charEntered          += handleText;
            (ic[InputComponent.GUIBindings.TEXT] as TextBinding).keyLifted            += handleTextUp;
            (ic[InputComponent.GUIBindings.HORIZONTALAXIS] as AxisBinding).valChanged += handleHorizontal;
            (ic[InputComponent.GUIBindings.VERTICALAXIS] as AxisBinding).valChanged   += handleVertical;
            ic.setContext(typeof(InputComponent.GUIBindings), saved);
            ic.setContext(typeof(InputComponent.EngineBindings), this); //Binding for fullscreen.
            (ic[InputComponent.EngineBindings.FULLSCREEN] as SinglePressBinding).downEvent += graphics.toggleFullScreen;
        }
Exemplo n.º 9
0
 /**
  * desc here
  *
  * @param paramsdeschere
  *
  * @return returndeschere
  */
 public MouseKeyBinding(InputComponent input)
     : base(input)
 {
 }
Exemplo n.º 10
0
 public InputBinding(InputComponent input)
 {
     this.input = input;
 }
 /**
  * desc here
  *
  * @param paramsdeschere
  *
  * @return returndeschere
  */
 public TextBinding(InputComponent input)
     : base(input)
 {
 }
        private int downCount;   ///< Number of bound buttons currently pressed

        /**
         * desc here
         *
         * @param paramsdeschere
         *
         * @return returndeschere
         */
        public SinglePressBinding(InputComponent input, ButtonEvent[] buttons)
            : base(input)
        {
            this.buttons = buttons;
        }