Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
keystouielements.c
Go to the documentation of this file.
1 //
2 // Keep this Object up-to-date with KeyCodes Enum in EnSystem.c
3 //
4 // KeysToUIElements is mapping of KeyCodes to its literal name or icon from ImageSet
5 // that will be displayed in floating widget for Default Actions - aka Action Target Selection
6 
8 
10 {
11  static private ref map<int, ref KeyToUIElement> m_KeysToUIElements;
12 
13  static private void RegisterKeyToUIElement(int key_code, string name, bool is_image_set )
14  {
15  if ( m_KeysToUIElements == NULL )
16  {
17  m_KeysToUIElements = new map<int, ref KeyToUIElement>;
18  }
19 
20  if ( m_KeysToUIElements.Contains(key_code) )
21  {
22  Debug.Log("Template ID: "+string.ToString(key_code)+" is alredy exist!", "KeysToUIElements -> OnInit()", "System", "KeysToUIElements Registration", "None");
23  }
24  else
25  {
26  KeyToUIElement params = new KeyToUIElement(name, is_image_set);
27  m_KeysToUIElements.Set(key_code, params);
28  }
29  }
30 
31  static KeyToUIElement GetKeyToUIElement(int key_code)
32  {
33  if ( m_KeysToUIElements && m_KeysToUIElements.Contains(key_code) )
34  {
35  return m_KeysToUIElements.Get(key_code);
36  }
37 
38  Debug.Log("Template ID: "+string.ToString(key_code)+" does not exist!", "KeysToUIElements -> GetKeysToUIElement()", "System", "Get KeysToUIElements", "None");
39  return NULL;
40  }
41 
42  static void Init()
43  {
46  // | KeyCode | Name | is_image_set //
47  RegisterKeyToUIElement( KeyCode.KC_ESCAPE , "ESC" , false );
48  RegisterKeyToUIElement( KeyCode.KC_1 , "1" , false );
49  RegisterKeyToUIElement( KeyCode.KC_2 , "2" , false );
50  RegisterKeyToUIElement( KeyCode.KC_3 , "3" , false );
51  RegisterKeyToUIElement( KeyCode.KC_4 , "4" , false );
52  RegisterKeyToUIElement( KeyCode.KC_5 , "5" , false );
53  RegisterKeyToUIElement( KeyCode.KC_6 , "6" , false );
54  RegisterKeyToUIElement( KeyCode.KC_7 , "7" , false );
55  RegisterKeyToUIElement( KeyCode.KC_8 , "8" , false );
56  RegisterKeyToUIElement( KeyCode.KC_9 , "9" , false );
57  RegisterKeyToUIElement( KeyCode.KC_0 , "0" , false );
58  RegisterKeyToUIElement( KeyCode.KC_MINUS , "-" , false );
59  RegisterKeyToUIElement( KeyCode.KC_EQUALS , "=" , false );
60  RegisterKeyToUIElement( KeyCode.KC_BACK , "BKSPC" , false );
61  RegisterKeyToUIElement( KeyCode.KC_TAB , "TAB" , false );
62  RegisterKeyToUIElement( KeyCode.KC_Q , "Q" , false );
63  RegisterKeyToUIElement( KeyCode.KC_W , "W" , false );
64  RegisterKeyToUIElement( KeyCode.KC_E , "E" , false );
65  RegisterKeyToUIElement( KeyCode.KC_R , "R" , false );
66  RegisterKeyToUIElement( KeyCode.KC_T , "T" , false );
67  RegisterKeyToUIElement( KeyCode.KC_Y , "Y" , false );
68  RegisterKeyToUIElement( KeyCode.KC_U , "U" , false );
69  RegisterKeyToUIElement( KeyCode.KC_I , "I" , false );
70  RegisterKeyToUIElement( KeyCode.KC_O , "O" , false );
71  RegisterKeyToUIElement( KeyCode.KC_P , "P" , false );
72  RegisterKeyToUIElement( KeyCode.KC_LBRACKET , "(" , false );
73  RegisterKeyToUIElement( KeyCode.KC_RBRACKET , ")" , false );
74  RegisterKeyToUIElement( KeyCode.KC_RETURN , "ENTER" , false );
75  RegisterKeyToUIElement( KeyCode.KC_LCONTROL , "LCTRL" , false );
76  RegisterKeyToUIElement( KeyCode.KC_A , "A" , false );
77  RegisterKeyToUIElement( KeyCode.KC_S , "S" , false );
78  RegisterKeyToUIElement( KeyCode.KC_D , "D" , false );
79  RegisterKeyToUIElement( KeyCode.KC_F , "F" , false );
80  RegisterKeyToUIElement( KeyCode.KC_G , "G" , false );
81  RegisterKeyToUIElement( KeyCode.KC_H , "H" , false );
82  RegisterKeyToUIElement( KeyCode.KC_J , "J" , false );
83  RegisterKeyToUIElement( KeyCode.KC_K , "K" , false );
84  RegisterKeyToUIElement( KeyCode.KC_L , "L" , false );
85  RegisterKeyToUIElement( KeyCode.KC_SEMICOLON , ";" , false );
86  RegisterKeyToUIElement( KeyCode.KC_APOSTROPHE , "'" , false );
87  RegisterKeyToUIElement( KeyCode.KC_GRAVE , "`" , false );
88  RegisterKeyToUIElement( KeyCode.KC_LSHIFT , "LSHIFT" , false );
89  RegisterKeyToUIElement( KeyCode.KC_BACKSLASH , "\\" , false );
90  RegisterKeyToUIElement( KeyCode.KC_Z , "Z" , false );
91  RegisterKeyToUIElement( KeyCode.KC_X , "X" , false );
92  RegisterKeyToUIElement( KeyCode.KC_C , "C" , false );
93  RegisterKeyToUIElement( KeyCode.KC_V , "V" , false );
94  RegisterKeyToUIElement( KeyCode.KC_B , "B" , false );
95  RegisterKeyToUIElement( KeyCode.KC_N , "N" , false );
96  RegisterKeyToUIElement( KeyCode.KC_M , "M" , false );
97  RegisterKeyToUIElement( KeyCode.KC_COMMA , "," , false );
98  RegisterKeyToUIElement( KeyCode.KC_PERIOD , "." , false );
99  RegisterKeyToUIElement( KeyCode.KC_SLASH , "/" , false );
100  RegisterKeyToUIElement( KeyCode.KC_RSHIFT , "RSHIFT" , false );
101  RegisterKeyToUIElement( KeyCode.KC_MULTIPLY , "*" , false );
102  RegisterKeyToUIElement( KeyCode.KC_LMENU , "LALT" , false );
103  RegisterKeyToUIElement( KeyCode.KC_SPACE , "SPACE" , false );
104  RegisterKeyToUIElement( KeyCode.KC_CAPITAL , "CPSLOCK" , false );
105  RegisterKeyToUIElement( KeyCode.KC_F1 , "F1" , false );
106  RegisterKeyToUIElement( KeyCode.KC_F2 , "F2" , false );
107  RegisterKeyToUIElement( KeyCode.KC_F3 , "F3" , false );
108  RegisterKeyToUIElement( KeyCode.KC_F4 , "F4" , false );
109  RegisterKeyToUIElement( KeyCode.KC_F5 , "F5" , false );
110  RegisterKeyToUIElement( KeyCode.KC_F6 , "F6" , false );
111  RegisterKeyToUIElement( KeyCode.KC_F7 , "F7" , false );
112  RegisterKeyToUIElement( KeyCode.KC_F8 , "F8" , false );
113  RegisterKeyToUIElement( KeyCode.KC_F9 , "F9" , false );
114  RegisterKeyToUIElement( KeyCode.KC_F10 , "F10" , false );
115  RegisterKeyToUIElement( KeyCode.KC_NUMLOCK , "NMLOCK" , false );
116  RegisterKeyToUIElement( KeyCode.KC_SCROLL , "SCRLOCK" , false );
117  RegisterKeyToUIElement( KeyCode.KC_NUMPAD7 , "Num7" , false );
118  RegisterKeyToUIElement( KeyCode.KC_NUMPAD8 , "Num8" , false );
119  RegisterKeyToUIElement( KeyCode.KC_NUMPAD9 , "Num9" , false );
120  RegisterKeyToUIElement( KeyCode.KC_SUBTRACT , "Num-" , false );
121  RegisterKeyToUIElement( KeyCode.KC_NUMPAD4 , "Num4" , false );
122  RegisterKeyToUIElement( KeyCode.KC_NUMPAD5 , "Num5" , false );
123  RegisterKeyToUIElement( KeyCode.KC_NUMPAD6 , "Num6" , false );
124  RegisterKeyToUIElement( KeyCode.KC_ADD , "Num+" , false );
125  RegisterKeyToUIElement( KeyCode.KC_NUMPAD1 , "Num1" , false );
126  RegisterKeyToUIElement( KeyCode.KC_NUMPAD2 , "Num2" , false );
127  RegisterKeyToUIElement( KeyCode.KC_NUMPAD3 , "Num3" , false );
128  RegisterKeyToUIElement( KeyCode.KC_NUMPAD0 , "Num0" , false );
129  RegisterKeyToUIElement( KeyCode.KC_DECIMAL , "Num." , false );
130  //RegisterKeyToUIElement( KeyCode.KC_OEM_102, ///< < > | on UK/Germany keyboards
131  RegisterKeyToUIElement( KeyCode.KC_F11 , "F11" , false );
132  RegisterKeyToUIElement( KeyCode.KC_F12 , "F12" , false );
133  RegisterKeyToUIElement( KeyCode.KC_NUMPADEQUALS , "Num=" , false );
134  RegisterKeyToUIElement( KeyCode.KC_PREVTRACK , "PrevTrack" , false );
135  //RegisterKeyToUIElement( KeyCode.KC_AT, ///< (NEC PC98)
136  RegisterKeyToUIElement( KeyCode.KC_COLON , ":" , false );
137  RegisterKeyToUIElement( KeyCode.KC_UNDERLINE , "_" , false );
138  //RegisterKeyToUIElement( KeyCode.KC_STOP, ///< (NEC PC98)
139  //RegisterKeyToUIElement( KeyCode.KC_AX, ///< (Japan AX)
140  //RegisterKeyToUIElement( KeyCode.KC_UNLABELED, ///< (J3100)
141  RegisterKeyToUIElement( KeyCode.KC_NEXTTRACK , "NextTrack" , false );
142  RegisterKeyToUIElement( KeyCode.KC_NUMPADENTER , "NumEnter" , false );
143  RegisterKeyToUIElement( KeyCode.KC_RCONTROL , "RCTRL" , false );
144  RegisterKeyToUIElement( KeyCode.KC_MUTE , "Mute" , false );
145  RegisterKeyToUIElement( KeyCode.KC_CALCULATOR , "Calc" , false );
146  RegisterKeyToUIElement( KeyCode.KC_PLAYPAUSE , "Play" , false );
147  RegisterKeyToUIElement( KeyCode.KC_MEDIASTOP , "Stop" , false );
148  RegisterKeyToUIElement( KeyCode.KC_VOLUMEDOWN , "Vol-" , false );
149  RegisterKeyToUIElement( KeyCode.KC_VOLUMEUP , "Vol+" , false );
150  RegisterKeyToUIElement( KeyCode.KC_WEBHOME , "Web Home" , false );
151  RegisterKeyToUIElement( KeyCode.KC_NUMPADCOMMA , "Num," , false );
152  RegisterKeyToUIElement( KeyCode.KC_DIVIDE , "Num/" , false );
153  RegisterKeyToUIElement( KeyCode.KC_SYSRQ , "SysRq" , false );
154  RegisterKeyToUIElement( KeyCode.KC_RMENU , "RALT" , false );
155  RegisterKeyToUIElement( KeyCode.KC_PAUSE , "Pause" , false );
156  RegisterKeyToUIElement( KeyCode.KC_HOME , "Home" , false );
157  RegisterKeyToUIElement( KeyCode.KC_UP , "ArrowUp" , false );
158  RegisterKeyToUIElement( KeyCode.KC_PRIOR , "PageUp" , false );
159  RegisterKeyToUIElement( KeyCode.KC_LEFT , "ArrowLeft" , false );
160  RegisterKeyToUIElement( KeyCode.KC_RIGHT , "ArrowRight" , false );
161  RegisterKeyToUIElement( KeyCode.KC_END , "End" , false );
162  RegisterKeyToUIElement( KeyCode.KC_DOWN , "ArrowDown" , false );
163  RegisterKeyToUIElement( KeyCode.KC_NEXT , "PgDn" , false );
164  RegisterKeyToUIElement( KeyCode.KC_INSERT , "Insert" , false );
165  RegisterKeyToUIElement( KeyCode.KC_DELETE , "Delete" , false );
166  RegisterKeyToUIElement( KeyCode.KC_LWIN , "LWIN" , false );
167  RegisterKeyToUIElement( KeyCode.KC_RWIN , "RWIN" , false );
168  //RegisterKeyToUIElement( KeyCode.KC_APPS, ///< AppMenu key
169  //RegisterKeyToUIElement( KeyCode.KC_POWER, ///< System Power
170  //RegisterKeyToUIElement( KeyCode.KC_SLEEP, ///< System Sleep
171  //RegisterKeyToUIElement( KeyCode.KC_WAKE, ///< System Wake
172  //RegisterKeyToUIElement( KeyCode.KC_MEDIASELECT ///< Media Selection
173  // Mouse buttons
174  RegisterKeyToUIElement( 1048576 , "set:dayz_gui image:left_mouse" , true );
175  RegisterKeyToUIElement( 1048577 , "set:dayz_gui image:right_mouse" , true );
176  RegisterKeyToUIElement( 1048578 , "set:dayz_gui image:middle_mouse" , true );
177  }
178 }
Param2
Definition: ppeconstants.c:66
KeysToUIElements
Definition: keystouielements.c:9
KeyCode
KeyCode
Definition: ensystem.c:156
ToString
proto string ToString()
map
map
Definition: controlsxboxnew.c:3
KeyToUIElement
Param2< string, bool > KeyToUIElement
Definition: keystouielements.c:7
name
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
Debug
Definition: debug.c:13