AudioAsset
Ease
FastString
FontAsset
NineSlice
PackedSprite
PackedSpriteID
RB
   HardwareSettings
   IRetroBlitGame
RBAsset
Rect2i
ShaderAsset
SoundReference
SpriteGrid
SpriteSheetAsset
TMXMapAsset
   TMXLayer
   TMXLayerLoadState
   TMXObject
   TMXObjectGroup
   TMXProperties
Vector2i

RB.ButtonPressed

Method  -  Static

public static bool ButtonPressed(int button, int player = RB.PLAYER_ONE, int repeatRate = 0)

Parameters

button int A bitmask of one or multiple buttons
player int A bitmask of players to check, or RB.PLAYER_ANY to check any player. Defaults to RB.PLAYER_ONE
repeatRate int Button repeat rate in frames, if > 0 then the button will re-trigger at this repeat rate

Returns

bool

True if button(s) pressed

Description

Return true if any of the given button(s) went from an up to down state since IRetroBlitGame.Update was last called. Supported buttons are:

Multiple buttons can be checked at once by ORing them. A few useful combinations are provided: If player parameter is not provided then by default only RB.PLAYER_ONE buttons will be checked. Optionally any player can be specified: Players can also be ORed to check for more than one player, or RB.PLAYER_ANY can be used to check for any player.

Example

AudioAsset soundBeepBoop = new AudioAsset();

void Update() {
    if (RB.ButtonPressed(RB.BTN_A | RB.BTN_BRB.PLAYER_ONE | RB.PLAYER_TWO) {
        RB.SoundPlay(soundBeepBoop);
    }
}

See Also

RB.ButtonReleased
RB.ButtonDown
RB.InputOverride

See Docs

Features - Gamepads
Features - Gamepad Input Override