Example #1
0
        // Gets the input args of the game
        public static InputArgs getInputArgs()
        {
            // Variables
            InputArgs	args=	new InputArgs();
            OTKInput.MouseState	tempm=	OTKInput.Mouse.GetState();
            MBL	mbuttons=	MBL.NONE;
            Point2	nmp=	new Point2(tempm.X, tempm.Y); // New Mouse Location

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

            // Keyboard State
            args.keyboard.kstate=	OTKInput.Keyboard.GetState();

            // Mouse State
            if(viewport!= null)
            {
                // Variables
                Sdx.Point	pt=	Forms.Cursor.Position;

                pt=	viewport.PointToClient(pt);

                nmp=	new Point2(pt.X, pt.Y);
            }
            if(tempm.LeftButton== OTKInput.ButtonState.Pressed)
                mbuttons|=	MBL.LMB;
            if(tempm.MiddleButton== OTKInput.ButtonState.Pressed)
                mbuttons|=	MBL.MMB;
            if(tempm.RightButton== OTKInput.ButtonState.Pressed)
                mbuttons|=	MBL.RMB;
            if(tempm.XButton1== OTKInput.ButtonState.Pressed)
                mbuttons|=	MBL.XB1;
            if(tempm.XButton2== OTKInput.ButtonState.Pressed)
                mbuttons|=	MBL.XB2;
            if(tempm.Wheel> 0)
                mbuttons|=	MBL.WHEEL_UP;
            if(tempm.Wheel< 0)
                mbuttons|=	MBL.WHEEL_DOWN;
            if(!lmp.Equals(nmp))
            {
                if(nmp.y< lmp.y)
                    mbuttons|=	MBL.MOVE_UP;
                if(nmp.x> lmp.x)
                    mbuttons|=	MBL.MOVE_RIGHT;
                if(nmp.y> lmp.y)
                    mbuttons|=	MBL.MOVE_DOWN;
                if(nmp.x< lmp.x)
                    mbuttons|=	MBL.MOVE_LEFT;
                lmp=	nmp;
            }
            args.mouse.buttons=	mbuttons;
            args.mouse.pWheelDelta=	tempm.ScrollWheelValue;
            args.mouse.wheelDeltaPrecise=	tempm.WheelPrecise;
            args.mouse.mousePosition=	nmp;

            return args;
        }
Example #2
0
 // Handles the input for the game state
 public override void handleInput(InputArgs args)
 {
     if(args.isKeyDown(KKL.F))
         p.bEnabled=	true;
     if(args.isKeyDown(KKL.G))
         p.bEnabled=	false;
     if(args.isKeyDown(KKL.U))
         p.progress-=	0.001f;
     if(args.isKeyDown(KKL.O))
         p.progress+=	0.001f;
 }
Example #3
0
 // Handles the input of the gui
 public virtual void handleInput(InputArgs args)
 {
     for(int i= 0; i< actives.size; i++)
         csets.getViaIndex(actives.items[i]).handleInput(ref game, ref args);
 }