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

Method KeyDown

client/src/main/java/jake2/client/CL_input.java:111–141  ·  view source on GitHub ↗
(kbutton_t b, List<String> args)

Source from the content-addressed store, hash-verified

109 private static int in_impulse;
110
111 private static void KeyDown(kbutton_t b, List<String> args) {
112 int k;
113
114 if (args.size() >= 2)
115 k = Lib.atoi(args.get(1));
116 else
117 k = -1; // typed manually at the console for continuous down
118
119 if (k == b.down[0] || k == b.down[1])
120 return; // repeating key
121
122 if (b.down[0] == 0)
123 b.down[0] = k;
124 else if (b.down[1] == 0)
125 b.down[1] = k;
126 else {
127 Com.Printf("Three keys down for a button!\n");
128 return;
129 }
130
131 if ((b.state & 1) != 0)
132 return; // still down
133
134 // save timestamp
135 if (args.size() >= 3)
136 b.downtime = Lib.atoi(args.get(2));
137 else
138 b.downtime = Globals.sys_frame_time - 100;
139
140 b.state |= 3; // down + impulse down
141 }
142
143 private static void KeyUp(kbutton_t b, List<String> args) {
144 int k;

Callers 1

InitInputMethod · 0.95

Calls 4

atoiMethod · 0.95
PrintfMethod · 0.95
sizeMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected