本文整理汇总了C++中wxWindow::AddPendingEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ wxWindow::AddPendingEvent方法的具体用法?C++ wxWindow::AddPendingEvent怎么用?C++ wxWindow::AddPendingEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxWindow
的用法示例。
在下文中一共展示了wxWindow::AddPendingEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Entry
void* wxJoystickThread::Entry()
{
struct js_event j_evt;
fd_set read_fds;
struct timeval time_out = {0, 0};
FD_ZERO(&read_fds);
while (true)
{
if (TestDestroy())
break;
// We use select when either polling or 'blocking' as even in the
// blocking case we need to check TestDestroy periodically
if (m_polling)
time_out.tv_usec = m_polling * 1000;
else
time_out.tv_usec = 10 * 1000; // check at least every 10 msec in blocking case
FD_SET(m_device, &read_fds);
select(m_device+1, &read_fds, NULL, NULL, &time_out);
if (FD_ISSET(m_device, &read_fds))
{
memset(&j_evt, 0, sizeof(j_evt));
read(m_device, &j_evt, sizeof(j_evt));
//printf("time: %d\t value: %d\t type: %d\t number: %d\n",
// j_evt.time, j_evt.value, j_evt.type, j_evt.number);
wxJoystickEvent jwx_event;
if (j_evt.type & JS_EVENT_AXIS)
{
m_axe[j_evt.number] = j_evt.value;
switch (j_evt.number)
{
case wxJS_AXIS_X:
m_lastposition.x = j_evt.value;
jwx_event.SetEventType(wxEVT_JOY_MOVE);
break;
case wxJS_AXIS_Y:
m_lastposition.y = j_evt.value;
jwx_event.SetEventType(wxEVT_JOY_MOVE);
break;
case wxJS_AXIS_Z:
jwx_event.SetEventType(wxEVT_JOY_ZMOVE);
break;
default:
jwx_event.SetEventType(wxEVT_JOY_MOVE);
// TODO: There should be a way to indicate that the event
// is for some other axes.
break;
}
}
if (j_evt.type & JS_EVENT_BUTTON)
{
if (j_evt.value)
{
m_buttons |= (1 << j_evt.number);
jwx_event.SetEventType(wxEVT_JOY_BUTTON_DOWN);
}
else
{
m_buttons &= ~(1 << j_evt.number);
jwx_event.SetEventType(wxEVT_JOY_BUTTON_UP);
}
jwx_event.SetButtonChange(j_evt.number);
jwx_event.SetTimestamp(j_evt.time);
jwx_event.SetJoystick(m_joystick);
jwx_event.SetButtonState(m_buttons);
jwx_event.SetPosition(m_lastposition);
jwx_event.SetZPosition(m_axe[3]);
jwx_event.SetEventObject(m_catchwin);
if (m_catchwin)
m_catchwin->AddPendingEvent(jwx_event);
}
}
}
close(m_device);
return NULL;
}