コード例 #1
0
 internal void Update(AppTime appTime, Input.InputFrame inputFrame)
 {
     for (Int32 i = 0; i < Components.Count; ++i)
     {
         Components [i].Poll (appTime, inputFrame);
     }
 }
コード例 #2
0
 internal override void Poll(AppTime time, Input.InputFrame inputFrame)
 {
     touches.ClearBuffer ();
     foreach (var rawTouch in inputFrame.ActiveTouches)
     {
         touches.RegisterTouch (
             rawTouch.Id, rawTouch.Position, rawTouch.Phase, time.FrameNumber, time.Elapsed);
     }
 }
コード例 #3
0
 internal virtual void Poll(AppTime appTime, Input.InputFrame inputFrame)
 {
 }
コード例 #4
0
ファイル: Input.cs プロジェクト: gitter-badger/blimey
        internal void Update(AppTime appTime)
        {
            UpdateCurrentInputFrame ();

            foreach (var hid in this.humanInputDevices)
            {
                hid.Update (appTime, inputFrame);
            }
        }
コード例 #5
0
        internal override void Poll(AppTime appTime, Input.InputFrame inputFrame)
        {
            switch (gamepad)
            {
                case Gamepad.Xbox360:
                    {
                        switch (playerIndex.Value)
                        {
                            case PlayerIndex.One:
                                {
                                    Left = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_0_LeftTrigger);
                                    Right = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_0_RightTrigger);
                                }
                                break;

                            case PlayerIndex.Two:
                                {
                                    Left = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_1_LeftTrigger);
                                    Right = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_1_RightTrigger);
                                }
                                break;

                            case PlayerIndex.Three:
                                {
                                    Left = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_2_LeftTrigger);
                                    Right = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_2_RightTrigger);
                                }
                                break;

                            case PlayerIndex.Four:
                                {
                                    Left = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_3_LeftTrigger);
                                    Right = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_3_RightTrigger);
                                }
                                break;
                        }
                    }
                    break;

                default: throw new NotSupportedException ();
            }
        }
コード例 #6
0
ファイル: BasicApp.cs プロジェクト: gitter-badger/blimey
        public Boolean Update(Platform platform, AppTime time)
        {
            if (platform.Input.Keyboard.IsFunctionalKeyDown (FunctionalKey.Escape))
                return true;

            colourChangeProgress += time.Delta / colourChangeTime;

            if (colourChangeProgress >= 1f)
            {
                colourChangeProgress = 0f;
                currentColour = nextColour;
                nextColour = RandomColours.GetNext();
            }

            foreach (var element in elements)
                element.Update (platform, time);

            return false;
        }
コード例 #7
0
        internal override void Poll(AppTime appTime, Input.InputFrame inputFrame)
        {
            switch (gamepad)
            {
                case Gamepad.Xbox360:
                    {
                        switch (playerIndex.Value)
                        {
                            case PlayerIndex.One:
                                {
                                    Left = new Vector2 {
                                        X = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_0_Leftstick_X),
                                        Y = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_0_Leftstick_Y)
                                    };
                                    Right = new Vector2 {
                                        X = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_0_Rightstick_X),
                                        Y = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_0_Rightstick_Y)
                                    };
                                }
                                break;

                            case PlayerIndex.Two:
                                {
                                    Left = new Vector2 {
                                        X = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_1_Leftstick_X),
                                        Y = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_1_Leftstick_Y)
                                    };
                                    Right = new Vector2 {
                                        X = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_1_Rightstick_X),
                                        Y = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_1_Rightstick_Y)
                                    };
                                }
                                break;

                            case PlayerIndex.Three:
                                {
                                    Left = new Vector2 {
                                        X = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_2_Leftstick_X),
                                        Y = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_2_Leftstick_Y)
                                    };
                                    Right = new Vector2 {
                                        X = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_2_Rightstick_X),
                                        Y = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_2_Rightstick_Y)
                                    };
                                }
                                break;

                            case PlayerIndex.Four:
                                {
                                    Left = new Vector2 {
                                        X = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_3_Leftstick_X),
                                        Y = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_3_Leftstick_Y)
                                    };
                                    Right = new Vector2 {
                                        X = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_3_Rightstick_X),
                                        Y = GetAnalogState (inputFrame, AnalogControlIdentifier.Xbox360_3_Rightstick_Y)
                                    };
                                }
                                break;
                        }
                    }
                    break;

                case Gamepad.PSM:
                    {
                        Left = new Vector2 {
                            X = GetAnalogState (inputFrame, AnalogControlIdentifier.PlayStationMobile_Leftstick_X),
                            Y = GetAnalogState (inputFrame, AnalogControlIdentifier.PlayStationMobile_Leftstick_Y)
                        };
                        Right = new Vector2 {
                            X = GetAnalogState (inputFrame, AnalogControlIdentifier.PlayStationMobile_Rightstick_X),
                            Y = GetAnalogState (inputFrame, AnalogControlIdentifier.PlayStationMobile_Rightstick_Y)
                        };
                    }
                    break;

                default: throw new NotSupportedException ();
            }
        }
コード例 #8
0
 internal override void Poll(AppTime appTime, Input.InputFrame inputFrame)
 {
     Triangle = GetButtonState (inputFrame, BinaryControlIdentifier.PlayStationMobile_Triangle);
     Square = GetButtonState (inputFrame, BinaryControlIdentifier.PlayStationMobile_Square);
     Circle = GetButtonState (inputFrame, BinaryControlIdentifier.PlayStationMobile_Circle);
     Cross = GetButtonState (inputFrame, BinaryControlIdentifier.PlayStationMobile_Cross);
     Start = GetButtonState (inputFrame, BinaryControlIdentifier.PlayStationMobile_Start);
     Select = GetButtonState (inputFrame, BinaryControlIdentifier.PlayStationMobile_Select);
     LeftShoulder = GetButtonState (inputFrame, BinaryControlIdentifier.PlayStationMobile_LeftSholder);
     RightShoulder = GetButtonState (inputFrame, BinaryControlIdentifier.PlayStationMobile_RightSholder);
 }
コード例 #9
0
ファイル: GamepadDPad.cs プロジェクト: gitter-badger/blimey
        internal override void Poll(AppTime appTime, Input.InputFrame inputFrame)
        {
            switch (gamepad)
            {
                case Gamepad.Xbox360:
                    {
                        switch (playerIndex.Value)
                        {
                            case PlayerIndex.One:
                                {
                                    Down = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_0_DPad_Down);
                                    Left = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_0_DPad_Left);
                                    Right = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_0_DPad_Right);
                                    Up = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_0_DPad_Up);
                                }
                                break;

                            case PlayerIndex.Two:
                                {
                                    Down = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_1_DPad_Down);
                                    Left = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_1_DPad_Left);
                                    Right = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_1_DPad_Right);
                                    Up = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_1_DPad_Up);
                                }
                                break;

                            case PlayerIndex.Three:
                                {
                                    Down = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_2_DPad_Down);
                                    Left = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_2_DPad_Left);
                                    Right = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_2_DPad_Right);
                                    Up = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_2_DPad_Up);
                                }
                                break;

                            case PlayerIndex.Four:
                                {
                                    Down = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_3_DPad_Down);
                                    Left = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_3_DPad_Left);
                                    Right = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_3_DPad_Right);
                                    Up = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_3_DPad_Up);
                                }
                                break;
                        }
                    }
                    break;

                case Gamepad.PSM:
                    {
                        Down = GetButtonState (inputFrame, BinaryControlIdentifier.PlayStationMobile_DPad_Down);
                        Left = GetButtonState (inputFrame, BinaryControlIdentifier.PlayStationMobile_DPad_Left);
                        Right = GetButtonState (inputFrame, BinaryControlIdentifier.PlayStationMobile_DPad_Right);
                        Up = GetButtonState (inputFrame, BinaryControlIdentifier.PlayStationMobile_DPad_Up);
                    }
                    break;

                default: throw new NotSupportedException ();
            }
        }
コード例 #10
0
ファイル: Mouse.cs プロジェクト: gitter-badger/blimey
 internal override void Poll(AppTime time, Input.InputFrame inputFrame)
 {
     Left = GetButtonState (inputFrame, BinaryControlIdentifier.Mouse_Left);
     Middle = GetButtonState (inputFrame, BinaryControlIdentifier.Mouse_Middle);
     Right = GetButtonState (inputFrame, BinaryControlIdentifier.Mouse_Right);
     ScrollWheelValue = GetDigitalState (inputFrame, DigitalControlIdentifier.Mouse_Wheel);
     X = GetDigitalState (inputFrame, DigitalControlIdentifier.Mouse_X);
     Y = GetDigitalState (inputFrame, DigitalControlIdentifier.Mouse_Y);
 }
コード例 #11
0
ファイル: Keyboard.cs プロジェクト: gitter-badger/blimey
        internal override void Poll(AppTime time, Input.InputFrame inputFrame)
        {
            PressedCharacterKeys.Clear ();
            PressedFunctionalKeys.Clear ();

            inputFrame.PressedCharacters.ToList ().ForEach (x => PressedCharacterKeys.Add (x));

            foreach (var key in mapping.Keys)
            {
                if (inputFrame.BinaryControlStates.Contains (key))
                    PressedFunctionalKeys.Add (mapping [key]);
            }
        }
コード例 #12
0
        internal override void Poll(AppTime appTime, Input.InputFrame inputFrame)
        {
            switch (playerIndex)
            {
                case PlayerIndex.Two:
                    {
                        A = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_1_A);
                        B = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_1_B);
                        Back = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_1_Back);
                        LeftShoulder = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_1_LeftSholder);
                        LeftStick = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_1_LeftThumbstick);
                        RightShoulder = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_1_RightSholder);
                        RightStick = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_1_RightThumbstick);
                        Start = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_1_Start);
                        X = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_1_X);
                        Y = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_1_Y);
                    }
                    break;

                case PlayerIndex.Three:
                    {
                        A = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_2_A);
                        B = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_2_B);
                        Back = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_2_Back);
                        LeftShoulder = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_2_LeftSholder);
                        LeftStick = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_2_LeftThumbstick);
                        RightShoulder = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_2_RightSholder);
                        RightStick = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_2_RightThumbstick);
                        Start = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_2_Start);
                        X = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_2_X);
                        Y = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_2_Y);
                    }
                    break;

                case PlayerIndex.Four:
                    {
                        A = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_3_A);
                        B = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_3_B);
                        Back = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_3_Back);
                        LeftShoulder = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_3_LeftSholder);
                        LeftStick = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_3_LeftThumbstick);
                        RightShoulder = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_3_RightSholder);
                        RightStick = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_3_RightThumbstick);
                        Start = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_3_Start);
                        X = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_3_X);
                        Y = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_3_Y);
                    }
                    break;

                case PlayerIndex.One:
                    {
                        A = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_0_A);
                        B = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_0_B);
                        Back = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_0_Back);
                        LeftShoulder = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_0_LeftSholder);
                        LeftStick = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_0_LeftThumbstick);
                        RightShoulder = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_0_RightSholder);
                        RightStick = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_0_RightThumbstick);
                        Start = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_0_Start);
                        X = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_0_X);
                        Y = GetButtonState (inputFrame, BinaryControlIdentifier.Xbox360_0_Y);
                    }
                    break;

                default: throw new NotSupportedException ();
            }
        }
コード例 #13
0
ファイル: Platform.cs プロジェクト: gitter-badger/blimey
        void Update()
        {
            if (firstUpdate)
            {
                firstUpdate = false;

                this.timer.Start ();

                this.userApp.Start (this);
            }

            var dt = (Single)(timer.Elapsed.TotalSeconds - previousTimeSpan.TotalSeconds);
            previousTimeSpan = timer.Elapsed;

            if (dt > 0.5f)
            {
                dt = 0.0f;
            }

            elapsedTime += dt;

            var appTime = new AppTime (dt, elapsedTime, ++frameCounter);

            this.input.Update (appTime);

            Boolean userAppToDie = this.userApp.Update (this, appTime);

            if (userAppToDie)
            {
                timer.Stop ();
                userApp.Stop (this);
                api.app_Stop ();
            }

            VertexBuffer.CollectGpuGarbage (api);
            IndexBuffer.CollectGpuGarbage (api);
            Texture.CollectGpuGarbage (api);
            Shader.CollectGpuGarbage (api);
        }