本文整理汇总了C++中ControllerMessage::get_abs方法的典型用法代码示例。如果您正苦于以下问题:C++ ControllerMessage::get_abs方法的具体用法?C++ ControllerMessage::get_abs怎么用?C++ ControllerMessage::get_abs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ControllerMessage
的用法示例。
在下文中一共展示了ControllerMessage::get_abs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
MessageProcessor::send(const ControllerMessage& msg_in,
const ControllerMessageDescriptor& msg_desc,
int msec_delta)
{
if (m_config && !m_config->empty())
{
ControllerMessage msg = msg_in;
#if 0
if (m_rumble_test)
{
log_debug("rumble: " << msg.get_abs(XBOX_AXIS_LT) << " " << msg.get_abs(XBOX_AXIS_RT));
set_rumble(static_cast<uint8_t>(msg.get_abs(XBOX_AXIS_LT)),
static_cast<uint8_t>(msg.get_abs(XBOX_AXIS_RT)));
}
#endif
// handling switching of configurations
if (m_config_toggle_button != -1)
{
bool last = m_oldmsg.get_key(m_config_toggle_button);
bool cur = msg.get_key(m_config_toggle_button);
if (cur && cur != last)
{
// reset old mapping to zero to not get stuck keys/axis
m_config->get_config()->get_emitter().reset_all_outputs();
// switch to the next input mapping
m_config->next_config();
log_info("switched to config: " << m_config->get_current_config());
}
}
// run the controller message through all modifier
for(std::vector<ModifierPtr>::iterator i = m_config->get_config()->get_modifier().begin();
i != m_config->get_config()->get_modifier().end();
++i)
{
(*i)->update(msec_delta, msg, m_desc);
}
m_config->get_config()->get_emitter().update(msec_delta);
// send current Xbox state to uinput
if (msg != m_oldmsg)
{
// Only send a new event out if something has changed,
// this is useful since some controllers send events
// even if nothing has changed, deadzone can cause this
// too
m_oldmsg = msg;
m_config->get_config()->get_emitter().send(msg);
}
}
}
示例2:
void
CompatModifier::update(int msec_delta, ControllerMessage& msg, const ControllerMessageDescriptor& desc)
{
if (m_dpad)
{
msg.set_abs(m_dpad_x, (-1 * msg.get_key(m_dpad_left)) + (+1 * msg.get_key(m_dpad_right)), -1, 1);
msg.set_abs(m_dpad_y, (-1 * msg.get_key(m_dpad_up)) + (+1 * msg.get_key(m_dpad_down)), -1, 1);
}
if (m_trigger)
{
msg.set_abs(m_abs_trigger,
msg.get_abs(m_rt) - msg.get_abs(m_lt),
-msg.get_abs_max(m_lt),
msg.get_abs_max(m_lt));
}
}
示例3:
void
SquareAxisModifier::update(int msec_delta, ControllerMessage& msg, const ControllerMessageDescriptor& desc)
{
int x = msg.get_abs(m_xaxis);
int y = msg.get_abs(m_yaxis);
squarify_axis(x, y);
msg.set_abs(m_xaxis, x);
msg.set_abs(m_yaxis, y);
}
示例4: get
int get(const ControllerMessage& msg)
{
return msg.get_abs(get_abs());
}