// Gets the input arguments of the current timing public static InputArgs getInputArgs() { // Variables InputArgs args= new InputArgs(); args.keyboard= new KeyboardState(); args.mouse= new MouseState(); // Keyboard stuffs if(keyboard!= null) { args.keyboard.keysFound= keyboard.keys; args.keyboard.keyStates= keyboard.states; } // Mouse Stuffs if(mouse!= null) { args.mouse.buttonsPressed= mouse.buttonsPressed; if(mouse.wheel> 0) args.mouse.buttonsPressed|= MBL.WHEEL_UP; else if(mouse.wheel< 0) args.mouse.buttonsPressed|= MBL.WHEEL_DOWN; args.mouse.wheel= mouse.wheel; args.mouse.position= mouse.position; args.mouse.movement= mouse.movement; mouse.movement= Vector.ZERO; } return args; }
// Handles the input of the component public virtual void handleInput(ref InputArgs args) { if(!pVisible) return; // Variables bool bBounds= pBox.contains(args.mouse.position); if(click!= 0) { if((click&1)!= 0 && args.isKeyUp(MBL.LMB)) click-= 1; if((click&2)!= 0 && args.isKeyUp(MBL.MMB)) click-= 2; if((click&4)!= 0 && args.isKeyUp(MBL.RMB)) click-= 4; if((click&8)!= 0 && args.isKeyUp(MBL.XB1)) click-= 8; if((click&16)!= 0 && args.isKeyUp(MBL.XB2)) click-= 16; if(click== 0) { if(eonMouseClick!= null) eonMouseClick(this, oldMouse); } } if(pEnabled && !bHover && bBounds) { bHover= true; if(eonMouseEnter!= null) eonMouseEnter(this, args.mouse); } if(pEnabled && bHover && bBounds) { if(eonMouseHover!= null) eonMouseHover(this, args.mouse); if(click== 0) { 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; oldMouse= args.mouse; } } if(pEnabled && bHover && !bBounds) { bHover= false; if(eonMouseLeave!= null) eonMouseLeave(this, args.mouse); } for(int i= 0; i< children.size; i++) children.items[i].handleInput(ref args); if(eonKeyPress!= null && args.isKeyDown(KKL.ANY)) eonKeyPress(this, args.keyboard); }
// Handles the input of the gui public void handleInput(InputArgs args) { for(int i= 0; i< actives.size; i++) csets.getViaIndex(actives.items[i]).handleInput(ref args); }