本文整理汇总了C++中Joystick::Outputs方法的典型用法代码示例。如果您正苦于以下问题:C++ Joystick::Outputs方法的具体用法?C++ Joystick::Outputs怎么用?C++ Joystick::Outputs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Joystick
的用法示例。
在下文中一共展示了Joystick::Outputs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
void Init( std::vector<Core::Device*>& devices )
{
// this is used to number the joysticks
// multiple joysticks with the same name shall get unique ids starting at 0
std::map<std::string, int> name_counts;
#ifdef USE_SDL_HAPTIC
if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC) >= 0)
{
// Correctly initialized
}
else
#endif
if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
{
// Failed to initialize
return;
}
// joysticks
for (int i = 0; i < SDL_NumJoysticks(); ++i)
{
SDL_Joystick* dev = SDL_JoystickOpen(i);
if (dev)
{
Joystick* js = new Joystick(dev, i, name_counts[GetJoystickName(i)]++);
// only add if it has some inputs/outputs
if (js->Inputs().size() || js->Outputs().size())
devices.push_back( js );
else
delete js;
}
}
}
示例2: Init
void Init( std::vector<ControllerInterface::Device*>& devices )
{
// this is used to number the joysticks
// multiple joysticks with the same name shall get unique ids starting at 0
std::map<std::string, int> name_counts;
if (SDL_Init( SDL_INIT_FLAGS ) >= 0)
{
// joysticks
for(int i = 0; i < SDL_NumJoysticks(); ++i)
{
SDL_Joystick* dev = SDL_JoystickOpen(i);
if (dev)
{
Joystick* js = new Joystick(dev, i, name_counts[SDL_JoystickName(i)]++);
// only add if it has some inputs/outputs
if (js->Inputs().size() || js->Outputs().size())
devices.push_back( js );
else
delete js;
}
}
}
}