GSDP:GAM100/CProcessing/CP Input KeyDown()

From Inside
Jump to: navigation, search

CP_Input_KeyDown()

Description

Returns TRUE if the key is down. Note: This is true on the first frame and any subsequent frames that the key may be held. Returns FALSE otherwise.

Parameters

CP_Input_KeyDown(CP_KEY keyCode)

  • keyCode - (CP_KEY) The key being checked.

Example

void update(void)
{
  // If this is the first frame the spacebar is pressed
  if (CP_Input_KeyTriggered(KEY_SPACE))
  {
    CP_Settings_Background(CP_Color_Create(255, 192, 203, 255));
  }
  // If spacebar is being held
  else if (CP_Input_KeyDown(KEY_SPACE))
  {
    CP_Settings_Background(CP_Color_Create(25, 180, 220, 255));
  }
  // If spacebar was just released
  else if (CP_Input_KeyReleased(KEY_SPACE))
  {
    CP_Settings_Background(CP_Color_Create(255, 128, 0, 255));
  }
  // Default state
  else
  {
    CP_Settings_Background(CP_Color_Create(0, 0, 0, 255));
  }
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>