Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CorsairKeyboard.cs
Go to the documentation of this file.
1using System;
4using Microsoft.Xna.Framework.Input;
5
7
9{
10 private readonly CorsairLedColor[] _ledColors;
11
13
15 {
16 {
17 CorsairLedId.CLK_Escape,
18 (Keys)27
19 },
20 {
21 CorsairLedId.CLK_F1,
22 (Keys)112
23 },
24 {
25 CorsairLedId.CLK_F2,
26 (Keys)113
27 },
28 {
29 CorsairLedId.CLK_F3,
30 (Keys)114
31 },
32 {
33 CorsairLedId.CLK_F4,
34 (Keys)115
35 },
36 {
37 CorsairLedId.CLK_F5,
38 (Keys)116
39 },
40 {
41 CorsairLedId.CLK_F6,
42 (Keys)117
43 },
44 {
45 CorsairLedId.CLK_F7,
46 (Keys)118
47 },
48 {
49 CorsairLedId.CLK_F8,
50 (Keys)119
51 },
52 {
53 CorsairLedId.CLK_F9,
54 (Keys)120
55 },
56 {
57 CorsairLedId.CLK_F10,
58 (Keys)121
59 },
60 {
61 CorsairLedId.CLK_F11,
62 (Keys)122
63 },
64 {
65 CorsairLedId.CLK_GraveAccentAndTilde,
66 (Keys)192
67 },
68 {
69 CorsairLedId.CLK_1,
70 (Keys)49
71 },
72 {
73 CorsairLedId.CLK_2,
74 (Keys)50
75 },
76 {
77 CorsairLedId.CLK_3,
78 (Keys)51
79 },
80 {
81 CorsairLedId.CLK_4,
82 (Keys)52
83 },
84 {
85 CorsairLedId.CLK_5,
86 (Keys)53
87 },
88 {
89 CorsairLedId.CLK_6,
90 (Keys)54
91 },
92 {
93 CorsairLedId.CLK_7,
94 (Keys)55
95 },
96 {
97 CorsairLedId.CLK_8,
98 (Keys)56
99 },
100 {
101 CorsairLedId.CLK_9,
102 (Keys)57
103 },
104 {
105 CorsairLedId.CLK_0,
106 (Keys)48
107 },
108 {
109 CorsairLedId.CLK_MinusAndUnderscore,
110 (Keys)189
111 },
112 {
113 CorsairLedId.CLK_Tab,
114 (Keys)9
115 },
116 {
117 CorsairLedId.CLK_Q,
118 (Keys)81
119 },
120 {
121 CorsairLedId.CLK_W,
122 (Keys)87
123 },
124 {
125 CorsairLedId.CLK_E,
126 (Keys)69
127 },
128 {
129 CorsairLedId.CLK_R,
130 (Keys)82
131 },
132 {
133 CorsairLedId.CLK_T,
134 (Keys)84
135 },
136 {
137 CorsairLedId.CLK_Y,
138 (Keys)89
139 },
140 {
141 CorsairLedId.CLK_U,
142 (Keys)85
143 },
144 {
145 CorsairLedId.CLK_I,
146 (Keys)73
147 },
148 {
149 CorsairLedId.CLK_O,
150 (Keys)79
151 },
152 {
153 CorsairLedId.CLK_P,
154 (Keys)80
155 },
156 {
157 CorsairLedId.CLK_BracketLeft,
158 (Keys)219
159 },
160 {
161 CorsairLedId.CLK_CapsLock,
162 (Keys)20
163 },
164 {
165 CorsairLedId.CLK_A,
166 (Keys)65
167 },
168 {
169 CorsairLedId.CLK_S,
170 (Keys)83
171 },
172 {
173 CorsairLedId.CLK_D,
174 (Keys)68
175 },
176 {
177 CorsairLedId.CLK_F,
178 (Keys)70
179 },
180 {
181 CorsairLedId.CLK_G,
182 (Keys)71
183 },
184 {
185 CorsairLedId.CLK_H,
186 (Keys)72
187 },
188 {
189 CorsairLedId.CLK_J,
190 (Keys)74
191 },
192 {
193 CorsairLedId.CLK_K,
194 (Keys)75
195 },
196 {
197 CorsairLedId.CLK_L,
198 (Keys)76
199 },
200 {
201 CorsairLedId.CLK_SemicolonAndColon,
202 (Keys)186
203 },
204 {
205 CorsairLedId.CLK_ApostropheAndDoubleQuote,
206 (Keys)222
207 },
208 {
209 CorsairLedId.CLK_LeftShift,
210 (Keys)160
211 },
212 {
213 CorsairLedId.CLK_Z,
214 (Keys)90
215 },
216 {
217 CorsairLedId.CLK_X,
218 (Keys)88
219 },
220 {
221 CorsairLedId.CLK_C,
222 (Keys)67
223 },
224 {
225 CorsairLedId.CLK_V,
226 (Keys)86
227 },
228 {
229 CorsairLedId.CLK_B,
230 (Keys)66
231 },
232 {
233 CorsairLedId.CLK_N,
234 (Keys)78
235 },
236 {
237 CorsairLedId.CLK_M,
238 (Keys)77
239 },
240 {
241 CorsairLedId.CLK_CommaAndLessThan,
242 (Keys)188
243 },
244 {
245 CorsairLedId.CLK_PeriodAndBiggerThan,
246 (Keys)190
247 },
248 {
249 CorsairLedId.CLK_SlashAndQuestionMark,
250 (Keys)191
251 },
252 {
253 CorsairLedId.CLK_LeftCtrl,
254 (Keys)162
255 },
256 {
257 CorsairLedId.CLK_LeftAlt,
258 (Keys)164
259 },
260 {
261 CorsairLedId.CLK_Space,
262 (Keys)32
263 },
264 {
265 CorsairLedId.CLK_RightAlt,
266 (Keys)165
267 },
268 {
269 CorsairLedId.CLK_Application,
270 (Keys)93
271 },
272 {
273 CorsairLedId.CLK_F12,
274 (Keys)123
275 },
276 {
277 CorsairLedId.CLK_PrintScreen,
278 (Keys)44
279 },
280 {
281 CorsairLedId.CLK_ScrollLock,
282 (Keys)145
283 },
284 {
285 CorsairLedId.CLK_PauseBreak,
286 (Keys)19
287 },
288 {
289 CorsairLedId.CLK_Insert,
290 (Keys)45
291 },
292 {
293 CorsairLedId.CLK_Home,
294 (Keys)36
295 },
296 {
297 CorsairLedId.CLK_PageUp,
298 (Keys)33
299 },
300 {
301 CorsairLedId.CLK_BracketRight,
302 (Keys)221
303 },
304 {
305 CorsairLedId.CLK_Backslash,
306 (Keys)226
307 },
308 {
309 CorsairLedId.CLK_Enter,
310 (Keys)13
311 },
312 {
313 CorsairLedId.CLK_EqualsAndPlus,
314 (Keys)187
315 },
316 {
317 CorsairLedId.CLK_Backspace,
318 (Keys)8
319 },
320 {
321 CorsairLedId.CLK_Delete,
322 (Keys)46
323 },
324 {
325 CorsairLedId.CLK_End,
326 (Keys)35
327 },
328 {
329 CorsairLedId.CLK_PageDown,
330 (Keys)34
331 },
332 {
333 CorsairLedId.CLK_RightShift,
334 (Keys)161
335 },
336 {
337 CorsairLedId.CLK_RightCtrl,
338 (Keys)163
339 },
340 {
341 CorsairLedId.CLK_UpArrow,
342 (Keys)38
343 },
344 {
345 CorsairLedId.CLK_LeftArrow,
346 (Keys)37
347 },
348 {
349 CorsairLedId.CLK_DownArrow,
350 (Keys)40
351 },
352 {
353 CorsairLedId.CLK_RightArrow,
354 (Keys)39
355 },
356 {
357 CorsairLedId.CLK_Mute,
358 (Keys)173
359 },
360 {
361 CorsairLedId.CLK_Stop,
362 (Keys)178
363 },
364 {
365 CorsairLedId.CLK_ScanPreviousTrack,
366 (Keys)177
367 },
368 {
369 CorsairLedId.CLK_PlayPause,
370 (Keys)179
371 },
372 {
373 CorsairLedId.CLK_ScanNextTrack,
374 (Keys)176
375 },
376 {
377 CorsairLedId.CLK_NumLock,
378 (Keys)144
379 },
380 {
381 CorsairLedId.CLK_KeypadSlash,
382 (Keys)111
383 },
384 {
385 CorsairLedId.CLK_KeypadAsterisk,
386 (Keys)106
387 },
388 {
389 CorsairLedId.CLK_KeypadMinus,
390 (Keys)109
391 },
392 {
393 CorsairLedId.CLK_KeypadPlus,
394 (Keys)107
395 },
396 {
397 CorsairLedId.CLK_Keypad7,
398 (Keys)103
399 },
400 {
401 CorsairLedId.CLK_Keypad8,
402 (Keys)104
403 },
404 {
405 CorsairLedId.CLK_Keypad9,
406 (Keys)105
407 },
408 {
409 CorsairLedId.CLK_Keypad4,
410 (Keys)100
411 },
412 {
413 CorsairLedId.CLK_Keypad5,
414 (Keys)101
415 },
416 {
417 CorsairLedId.CLK_Keypad6,
418 (Keys)102
419 },
420 {
421 CorsairLedId.CLK_Keypad1,
422 (Keys)97
423 },
424 {
425 CorsairLedId.CLK_Keypad2,
426 (Keys)98
427 },
428 {
429 CorsairLedId.CLK_Keypad3,
430 (Keys)99
431 },
432 {
433 CorsairLedId.CLK_Keypad0,
434 (Keys)96
435 },
436 {
437 CorsairLedId.CLK_KeypadPeriodAndDelete,
438 (Keys)46
439 },
440 {
441 CorsairLedId.CLK_VolumeUp,
442 (Keys)175
443 },
444 {
445 CorsairLedId.CLK_VolumeDown,
446 (Keys)174
447 }
448 };
449
452 {
453 //IL_0066: Unknown result type (might be due to invalid IL or missing references)
454 _ledColors = new CorsairLedColor[base.LedCount];
455 for (int i = 0; i < ledPositions.Length; i++)
456 {
457 _ledColors[i].LedId = ledPositions[i].LedId;
458 if (_corsairToXnaKeys.TryGetValue(ledPositions[i].LedId, out var value))
459 {
461 }
462 }
463 }
464
465 public override void Present()
466 {
467 //IL_0006: Unknown result type (might be due to invalid IL or missing references)
468 //IL_000b: Unknown result type (might be due to invalid IL or missing references)
469 //IL_0018: Unknown result type (might be due to invalid IL or missing references)
470 //IL_0036: Unknown result type (might be due to invalid IL or missing references)
471 //IL_0054: Unknown result type (might be due to invalid IL or missing references)
472 for (int i = 0; i < base.LedCount; i++)
473 {
475 _ledColors[i].R = (int)(processedLedColor.X * 255f);
476 _ledColors[i].G = (int)(processedLedColor.Y * 255f);
477 _ledColors[i].B = (int)(processedLedColor.Z * 255f);
478 }
479 if (_ledColors.Length != 0)
480 {
482 }
483 }
484
491
492 public override void Render(IEnumerable<RgbKey> keys)
493 {
494 //IL_0017: Unknown result type (might be due to invalid IL or missing references)
495 //IL_0028: Unknown result type (might be due to invalid IL or missing references)
496 //IL_002d: Unknown result type (might be due to invalid IL or missing references)
497 //IL_0030: Unknown result type (might be due to invalid IL or missing references)
498 foreach (RgbKey key in keys)
499 {
501 {
502 int index = value;
503 Color currentColor = key.CurrentColor;
504 SetLedColor(index, ((Color)(ref currentColor)).ToVector4());
505 }
506 }
507 }
508}
static Fragment CreateFragment(CorsairLedPosition[] leds, Vector2 offset)
static CorsairLedPosition[] GetLedPositionsForMouseMatOrKeyboard(int deviceIndex)
override void Render(IEnumerable< RgbKey > keys)
readonly Dictionary< Keys, int > _xnaKeyToIndex
static readonly Dictionary< CorsairLedId, Keys > _corsairToXnaKeys
CorsairKeyboard(Fragment fragment, CorsairLedPosition[] ledPositions, DeviceColorProfile colorProfile)
static CorsairKeyboard Create(int deviceIndex, DeviceColorProfile colorProfile)
static bool CorsairSetLedsColorsAsync(int size, [In][Out] CorsairLedColor[] ledsColors, IntPtr callback, IntPtr context)
Vector4 GetProcessedLedColor(int index)
Definition RgbDevice.cs:37
void SetLedColor(int index, Vector4 color)
Definition RgbDevice.cs:64
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
static readonly IntPtr Zero
Definition IntPtr.cs:18