GSDP:GAM100/CProcessing/CP Input MouseTriggered()

From Inside
Jump to: navigation, search

CP_Input_MouseTriggered()

Description

Returns TRUE if the mouse button was pressed this frame, note does not return TRUE on being held down. Returns FALSE otherwise.

Parameters

CP_Input_MouseTriggered(CP_MOUSE button)

  • button - (CP_MOUSE) The mouse button being checked.

Example

void update(void)
{
  // If this is the first frame the spacebar is pressed
  if (CP_Input_MouseTriggered(MOUSE_BUTTON_LEFT))
  {
    CP_Settings_Background(CP_Color_Create(255, 192, 203, 255));
  }
  // If spacebar is being held
  else if (CP_Input_MouseDown(MOUSE_BUTTON_LEFT))
  {
    CP_Settings_Background(CP_Color_Create(25, 180, 220, 255));
  }
  // If spacebar was just released
  else if (CP_Input_MouseReleased(MOUSE_BUTTON_LEFT))
  {
    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:>