本文整理汇总了C++中LED::GetLEDs方法的典型用法代码示例。如果您正苦于以下问题:C++ LED::GetLEDs方法的具体用法?C++ LED::GetLEDs怎么用?C++ LED::GetLEDs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LED
的用法示例。
在下文中一共展示了LED::GetLEDs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/**
* @brief
* Called when a control of the input controller has been activated
*/
void Application30::OnControl(Control &cControl)
{
// Get name of control
String sControl = cControl.GetName();
// Display control value
String sValue;
if (cControl.GetType() == ControlButton)
sValue = static_cast<Button&>(cControl).IsPressed() ? "<pressed>" : "<released>";
else if (cControl.GetType() == ControlAxis)
sValue = String::Format("%5.2f", static_cast<Axis&>(cControl).GetValue());
System::GetInstance()->GetConsole().Print("- '" + sControl + "': " + sValue + '\n');
// LED test
if ((cControl.GetName() == "Plus" || cControl.GetName() == "Minus") && static_cast<Button&>(cControl).IsPressed()) {
// Get LED control
LED *pLED = static_cast<LED*>(cControl.GetController()->GetControl("LED"));
if (pLED) {
// Change LED value
uint32 nLED = pLED->GetLEDs();
if (cControl.GetName() == "Plus")
nLED++;
else
nLED--;
if (nLED > 15)
nLED = 0;
pLED->SetLEDs(nLED);
}
}
// Rumble test
if (cControl.GetName() == "Button1" || cControl.GetName() == "Button2") {
// Get rumble control (try "Rumble3" first for joystick, then "Rumble1" for WiiMote)
Effect *pRumble = static_cast<Effect*>(cControl.GetController()->GetControl("Rumble3"));
if (!pRumble)
pRumble = static_cast<Effect*>(cControl.GetController()->GetControl("Rumble1"));
if (pRumble) {
// Enable or disable rumble?
if (cControl.GetName() == "Button1")
pRumble->SetValue(1.0f);
if (cControl.GetName() == "Button2")
pRumble->SetValue(0.0f);
}
}
}