MCPcopy Create free account
hub / github.com/demoth/jake2 / KeyState

Method KeyState

client/src/main/java/jake2/client/CL_input.java:183–205  ·  view source on GitHub ↗
(kbutton_t key)

Source from the content-addressed store, hash-verified

181 * Returns the fraction of the frame that the key was down ===============
182 */
183 private static float KeyState(kbutton_t key) {
184 float val;
185 long msec;
186
187 key.state &= 1; // clear impulses
188
189 msec = key.msec;
190 key.msec = 0;
191
192 if (key.state != 0) {
193 // still down
194 msec += Globals.sys_frame_time - key.downtime;
195 key.downtime = Globals.sys_frame_time;
196 }
197
198 val = (float) msec / frame_msec;
199 if (val < 0)
200 val = 0;
201 if (val > 1)
202 val = 1;
203
204 return val;
205 }
206
207 // ==========================================================================
208

Callers 2

AdjustAnglesMethod · 0.95
BaseMoveMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected