MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / poll

Method poll

linux/lnxcontroller.cpp:100–133  ·  view source on GitHub ↗

this functions polls the controllers if needed. some systems may not need to implement this function.

Source from the content-addressed store, hash-verified

98// this functions polls the controllers if needed. some systems may not need to implement
99// this function.
100void lnxgameController::poll() {
101 int64_t cur_frame_timer_ms;
102
103 if (m_Suspended)
104 return;
105
106 cur_frame_timer_ms = timer_GetMSTime();
107 if (m_frame_timer_ms == -1) {
108 // don't poll this frame.
109 m_frame_timer_ms = cur_frame_timer_ms;
110 g_last_frame_timer_ms = cur_frame_timer_ms;
111 g_accum_frame_time = 0.0f;
112 return;
113 }
114
115 m_frame_time = (float)((cur_frame_timer_ms - m_frame_timer_ms) / 1000.0);
116 m_frame_timer_ms = cur_frame_timer_ms;
117 g_accum_frame_time += m_frame_time;
118
119 if (g_accum_frame_time >= MOUSE_POLLING_TIME) {
120 g_accum_frame_time = 0.0f;
121 }
122
123 for (int ctl = 0; ctl < m_NumControls; ctl++) {
124 if (m_ControlList[ctl].id >= CTID_EXTCONTROL0) {
125 extctl_getpos(m_ControlList[ctl].id);
126 } else if (m_ControlList[ctl].id == CTID_MOUSE) {
127 // if ((cur_frame_timer_ms - g_last_frame_timer_ms) > CONTROLLER_POLLING_TIME) {
128 mouse_geteval();
129 // g_last_frame_timer_ms = cur_frame_timer_ms;
130 // }
131 }
132 }
133}
134
135// toggles use of deadzone for controllers. ctl can be 0 to ???
136// dead zone is from 0.0 to 0.5

Callers 2

PollControlsFunction · 0.45
DoUIMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected