示例#1
0
        // Handles the gui's input
        public virtual void handleInput(InputArgs args)
        {
            if(set== null)
                return;

            set.handleInput(ref args);
        }
示例#2
0
        // Handles the component's input
        public override void handleInput(ref InputArgs args)
        {
            for(int i= 0; i< containerSize; i++)
                components.items[i].handleInput(ref args);

            base.handleInput(ref args);
        }
示例#3
0
 // Called whenever the gamepad's buttons have been pressed
 public void callInvoke(InputArgs args)
 {
     switch(args.gkeys)
     {
         case GBL.START:	InputInvoker.invoke(ref invokes[0]);	break;
         case GBL.SELECT:	InputInvoker.invoke(ref invokes[1]);	break;
         case GBL.MENU:	InputInvoker.invoke(ref invokes[2]);	break;
         case GBL.BUTTON_A:	InputInvoker.invoke(ref invokes[3]);	break;
         case GBL.BUTTON_B:	InputInvoker.invoke(ref invokes[4]);	break;
         case GBL.BUTTON_C:	InputInvoker.invoke(ref invokes[5]);	break;
         case GBL.BUTTON_D:	InputInvoker.invoke(ref invokes[6]);	break;
         case GBL.BUTTON_E:	InputInvoker.invoke(ref invokes[7]);	break;
         case GBL.BUTTON_F:	InputInvoker.invoke(ref invokes[8]);	break;
         case GBL.BUTTON_G:	InputInvoker.invoke(ref invokes[9]);	break;
         case GBL.BUTTON_H:	InputInvoker.invoke(ref invokes[10]);	break;
         case GBL.BUTTON_I:	InputInvoker.invoke(ref invokes[11]);	break;
         case GBL.BUTTON_J:	InputInvoker.invoke(ref invokes[12]);	break;
         case GBL.BUTTON_K:	InputInvoker.invoke(ref invokes[13]);	break;
         case GBL.L1:	InputInvoker.invoke(ref invokes[14]);	break;
         case GBL.L2:	InputInvoker.invoke(ref invokes[15]);	break;
         case GBL.L3:	InputInvoker.invoke(ref invokes[16]);	break;
         case GBL.R1:	InputInvoker.invoke(ref invokes[17]);	break;
         case GBL.R2:	InputInvoker.invoke(ref invokes[18]);	break;
         case GBL.R3:	InputInvoker.invoke(ref invokes[19]);	break;
         case GBL.DPAD1_UP:	InputInvoker.invoke(ref invokes[20]);	break;
         case GBL.DPAD1_RIGHT:	InputInvoker.invoke(ref invokes[21]);	break;
         case GBL.DPAD1_DOWN:	InputInvoker.invoke(ref invokes[22]);	break;
         case GBL.DPAD1_LEFT:	InputInvoker.invoke(ref invokes[23]);	break;
         case GBL.DPAD2_UP:	InputInvoker.invoke(ref invokes[24]);	break;
         case GBL.DPAD2_RIGHT:	InputInvoker.invoke(ref invokes[25]);	break;
         case GBL.DPAD2_DOWN:	InputInvoker.invoke(ref invokes[26]);	break;
         case GBL.DPAD2_LEFT:	InputInvoker.invoke(ref invokes[27]);	break;
         case GBL.LSTICK_UP:
             if(args.direction.y>= invokes[28].threshold)
                 InputInvoker.invoke(ref invokes[28]);
             break;
         case GBL.LSTICK_RIGHT:
             if(args.direction.x>= invokes[29].threshold)
                 InputInvoker.invoke(ref invokes[29]);
             break;
         case GBL.LSTICK_DOWN:
             if(args.direction.y<= (-1f*invokes[30].threshold))
                 InputInvoker.invoke(ref invokes[30]);
             break;
         case GBL.LSTICK_LEFT:
             if(args.direction.x<= (-1f*invokes[31].threshold))
                 InputInvoker.invoke(ref invokes[31]);
             break;
         case GBL.RSTICK_UP:
             if(args.direction.y>= invokes[32].threshold)
                 InputInvoker.invoke(ref invokes[32]);
             break;
         case GBL.RSTICK_RIGHT:
             if(args.direction.x>= invokes[33].threshold)
                 InputInvoker.invoke(ref invokes[33]);
             break;
         case GBL.RSTICK_DOWN:
             if(args.direction.y<= (-1f*invokes[34].threshold))
                 InputInvoker.invoke(ref invokes[34]);
             break;
         case GBL.RSTICK_LEFT:
             if(args.direction.x<= (-1f*invokes[35].threshold))
                 InputInvoker.invoke(ref invokes[35]);
             break;
         case GBL.LTRIGGER:
             if(args.direction.z>= invokes[36].threshold)
                 InputInvoker.invoke(ref invokes[36]);
             break;
         case GBL.RTRIGGER:
             if(args.direction.z>= invokes[37].threshold)
                 InputInvoker.invoke(ref invokes[37]);
             break;
         default:	break;
     }
 }
示例#4
0
        // Gets an empty set of input args
        private static InputArgs getEmptyInputArgs()
        {
            // Variables
            InputArgs	args=	new InputArgs();

            args.keyboard=	KeyboardState.getEmpty();
            args.mouse=	MouseState.getEmpty();
            args.gamepad=	GamepadState.getEmpty();

            return args;
        }
示例#5
0
        // Gets the input args
        public static InputArgs getInputArgs()
        {
            if(!bFocused)
                return getEmptyInputArgs();

            // Variables
            InputArgs	args=	new InputArgs();

            args.keyboard=	getKeyboardState();
            args.mouse=	getMouseState();
            args.gamepad=	getGamepadState();

            return args;
        }
示例#6
0
 // Handles the component's input
 public override void handleInput(ref InputArgs args)
 {
     for(int i= 0; i< size; i++)
         components[i].handleInput(ref args);
 }
示例#7
0
        // Handles the input of the gui component
        public override void handleInput(ref InputArgs args)
        {
            // Variables
            bool	bBounds=	false;

            if(textSprites!= null)
            {
                for(int i= 0; i< textSprites.size; i++)
                {
                    if(textSprites.items[i].bvolume!= null)
                    {
                        if(textSprites.items[i].bvolume.contains(args.mouse.position))
                        {
                            bBounds=	true;

                            break;
                        }
                    }
                }
            }

            if(parent!= null && parent.focusedComp== this)
            {
                if(!isEventNull("onKeyPress") && args.keyboard.size!= 0)
                    call<KeyboardState>("onKeyPress", args.keyboard);

                if(!isEventNull("onGamepadPress") && args.gamepad.buttonsHeld!= GBL.NONE)
                    call<GamepadState>("onGamepadPress", args.gamepad);
            }

            if(!bBounds)
                click=	0;
            if(click!= 0)
            {
                if((click&1)!= 0)
                    if(args.isKeyUp(MBL.LMB))
                        click-=	1;
                if((click&2)!= 0)
                    if(args.isKeyUp(MBL.MMB))
                        click-=	2;
                if((click&4)!= 0)
                    if(args.isKeyUp(MBL.RMB))
                        click-=	4;
                if((click&8)!= 0)
                    if(args.isKeyUp(MBL.XB1))
                        click-=	8;
                if((click&16)!= 0)
                    if(args.isKeyUp(MBL.XB2))
                        click-=	16;
                if(click== 0 && bBounds)
                {
                    if(!isEventNull("onMouseClick"))
                        call<MouseState>("onMouseClick", tempClickState);
                }
            }
            if(pEnabled && !bHover && bBounds)
            {
                bHover=	true;
                if(!isEventNull("onMouseEnter"))
                    call<MouseState>("onMouseEnter", args.mouse);
            }
            if(pEnabled && bHover && bBounds)
            {
                if(!isEventNull("onMouseHover"))
                    call<MouseState>("onMouseHover", args.mouse);
                if(click== 0 && parent!= null && parent.focusedComp== this)
                {
                    if(args.isKeyDown(MBL.LMB))	click+=	1;
                    if(args.isKeyDown(MBL.MMB))	click+=	2;
                    if(args.isKeyDown(MBL.RMB))	click+=	4;
                    if(args.isKeyDown(MBL.XB1))	click+=	8;
                    if(args.isKeyDown(MBL.XB2))	click+=	16;

                    if(click!= 0)
                        tempClickState=	args.mouse;
                }
                if(parent!= null && parent.focusedComp!= this && parent.focusedComp.click== 0)
                    parent.focusedComp=	this;
            }
            if(pEnabled && bHover && !bBounds)
            {
                if(!isEventNull("onMouseLeave"))
                    call<MouseState>("onMouseLeave", args.mouse);
                bHover=	false;
            }
        }