本文整理汇总了C++中Joystick::eControle方法的典型用法代码示例。如果您正苦于以下问题:C++ Joystick::eControle方法的具体用法?C++ Joystick::eControle怎么用?C++ Joystick::eControle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Joystick
的用法示例。
在下文中一共展示了Joystick::eControle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processarEvento
void EventosJoysticks::processarEvento(const SDL_Event& evento)
{
Joystick* joy;
switch(evento.type)
{
case SDL_JOYAXISMOTION:
joy = identificarJoystick(evento.jaxis.which);
if(joy)
{
switch(evento.jaxis.axis)
{
case SDL_CONTROLLER_AXIS_LEFTX:
joy->x = evento.caxis.value/32767.0f;
filtrarInput(joy->x, joy);
break;
case SDL_CONTROLLER_AXIS_LEFTY:
joy->y = evento.caxis.value/32767.0f;
filtrarInput(joy->y, joy);
break;
case SDL_CONTROLLER_AXIS_RIGHTX:
joy->xDir = evento.caxis.value/32767.0f;
filtrarInput(joy->xDir, joy);
break;
case SDL_CONTROLLER_AXIS_RIGHTY:
joy->yDir = evento.caxis.value/32767.0f;
filtrarInput(joy->yDir, joy);
break;
case SDL_CONTROLLER_AXIS_TRIGGERLEFT:
joy->z = evento.caxis.value/32767.0f;
filtrarInput(joy->z, joy);
break;
case SDL_CONTROLLER_AXIS_TRIGGERRIGHT:
joy->zDir = evento.caxis.value/32767.0f;
filtrarInput(joy->zDir, joy);
break;
}
}
break;
case SDL_CONTROLLERBUTTONDOWN:
joy = identificarJoystick(evento.cbutton.which);
if (joy)
{
joy->segurando[evento.cbutton.button] = true;
if (evento.cbutton.state == SDL_PRESSED)
{
joy->pressionou[evento.cbutton.button] = true;
}
}
break;
case SDL_CONTROLLERBUTTONUP:
joy = identificarJoystick(evento.cbutton.which);
if (joy)
{
joy->segurando[evento.cbutton.button] = false;
if (evento.cbutton.state == SDL_RELEASED)
{
joy->soltou[evento.cbutton.button] = true;
}
}
break;
case SDL_JOYBUTTONDOWN:
joy = identificarJoystick(evento.jbutton.which);
if(joy)
{
if (joy->eControle())
{
// para aqui, pois controles são tratados separadamente
break;
}
joy->segurando[evento.jbutton.button] = true;
if(evento.jbutton.state == SDL_PRESSED)
{
joy->pressionou[evento.jbutton.button] = true;
}
}
break;
case SDL_JOYBUTTONUP:
joy = identificarJoystick(evento.jbutton.which);
if(joy)
{
if (joy->eControle())
{
// para aqui, pois controles são tratados separadamente
break;
}
//.........这里部分代码省略.........