CCInputState
CCInputState
Cocos2DHelper for reading input from keyboard, gamepad, and touch input. This class tracks both the current and previous state of the input devices, and implements query methods for high level input actions such as "move up through the menu" or "pause the game".
Inheritance: System.Object
Fields
Properties
Methods
IsBackPress(PlayerIndex?)
System.Boolean IsBackPress(PlayerIndex?)(System.NullableMicrosoft.Xna.Framework.PlayerIndex controllingPlayer)
Parameters:
controllingPlayer
(System.NullableMicrosoft.Xna.Framework.PlayerIndex)Returns:
System.Boolean
IsButtonPress(Buttons, PlayerIndex?, out PlayerIndex)
System.Boolean IsButtonPress(Buttons, PlayerIndex?, out PlayerIndex)(Microsoft.Xna.Framework.Input.Buttons button, System.NullableMicrosoft.Xna.Framework.PlayerIndex controllingPlayer, Microsoft.Xna.Framework.PlayerIndex playerIndex)
Helper for checking if a button was newly pressed during this update. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player. When a button press is detected, the output playerIndex reports which player pressed it.
Parameters:
button
(Microsoft.Xna.Framework.Input.Buttons)controllingPlayer
(System.NullableMicrosoft.Xna.Framework.PlayerIndex)playerIndex
(Microsoft.Xna.Framework.PlayerIndex)Returns:
System.Boolean
Example
IsButtonPressed(Buttons, PlayerIndex?, out PlayerIndex)
System.Boolean IsButtonPressed(Buttons, PlayerIndex?, out PlayerIndex)(Microsoft.Xna.Framework.Input.Buttons button, System.NullableMicrosoft.Xna.Framework.PlayerIndex controllingPlayer, Microsoft.Xna.Framework.PlayerIndex playerIndex)
Helper for checking if a button was pressed during this update. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player. When a button press is detected, the output playerIndex reports which player pressed it.
Parameters:
button
(Microsoft.Xna.Framework.Input.Buttons)controllingPlayer
(System.NullableMicrosoft.Xna.Framework.PlayerIndex)playerIndex
(Microsoft.Xna.Framework.PlayerIndex)Returns:
System.Boolean
Example
IsKeyPress(Keys, PlayerIndex?, out PlayerIndex)
System.Boolean IsKeyPress(Keys, PlayerIndex?, out PlayerIndex)(Microsoft.Xna.Framework.Input.Keys key, System.NullableMicrosoft.Xna.Framework.PlayerIndex controllingPlayer, Microsoft.Xna.Framework.PlayerIndex playerIndex)
Helper for checking if a key was newly pressed during this update. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player. When a keypress is detected, the output playerIndex reports which player pressed it.
Parameters:
key
(Microsoft.Xna.Framework.Input.Keys)controllingPlayer
(System.NullableMicrosoft.Xna.Framework.PlayerIndex)playerIndex
(Microsoft.Xna.Framework.PlayerIndex)Returns:
System.Boolean
Example
IsKeyPressed(Keys, PlayerIndex?, out PlayerIndex)
System.Boolean IsKeyPressed(Keys, PlayerIndex?, out PlayerIndex)(Microsoft.Xna.Framework.Input.Keys key, System.NullableMicrosoft.Xna.Framework.PlayerIndex controllingPlayer, Microsoft.Xna.Framework.PlayerIndex playerIndex)
Helper for checking if a key was pressed during this update. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player. When a keypress is detected, the output playerIndex reports which player pressed it.
Parameters:
key
(Microsoft.Xna.Framework.Input.Keys)controllingPlayer
(System.NullableMicrosoft.Xna.Framework.PlayerIndex)playerIndex
(Microsoft.Xna.Framework.PlayerIndex)Returns:
System.Boolean
Example
IsMouseButtonDown(CCMouseButtons)
System.Boolean IsMouseButtonDown(CCMouseButtons)(Cocos2D.CCMouseButtons button)
Parameters:
button
(Cocos2D.CCMouseButtons)Returns:
System.Boolean
IsMouseButtonPress(CCMouseButtons)
System.Boolean IsMouseButtonPress(CCMouseButtons)(Cocos2D.CCMouseButtons button)
Parameters:
button
(Cocos2D.CCMouseButtons)Returns:
System.Boolean
IsMouseButtonRelease(CCMouseButtons)
System.Boolean IsMouseButtonRelease(CCMouseButtons)(Cocos2D.CCMouseButtons button)
Parameters:
button
(Cocos2D.CCMouseButtons)Returns:
System.Boolean
IsMouseButtonUp(CCMouseButtons)
System.Boolean IsMouseButtonUp(CCMouseButtons)(Cocos2D.CCMouseButtons button)
Parameters:
button
(Cocos2D.CCMouseButtons)Returns:
System.Boolean
Update(float)
Update(float)(System.Single deltaTime)
Reads the latest state user input.
Parameters:
deltaTime
(System.Single)Example