MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / Hotkeys_FindPartial

Function Hotkeys_FindPartial

src/InputHandler.c:173–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171}
172
173int Hotkeys_FindPartial(int key) {
174 struct HotkeyData hk;
175 int i, modifiers = 0;
176
177 if (Input_IsCtrlPressed()) modifiers |= HOTKEY_MOD_CTRL;
178 if (Input_IsShiftPressed()) modifiers |= HOTKEY_MOD_SHIFT;
179 if (Input_IsAltPressed()) modifiers |= HOTKEY_MOD_ALT;
180
181 for (i = 0; i < HotkeysText.count; i++) {
182 hk = HotkeysList[i];
183 /* e.g. if holding Ctrl and Shift, a hotkey with only Ctrl modifiers matches */
184 if ((hk.mods & modifiers) == hk.mods && hk.trigger == key) return i;
185 }
186 return -1;
187}
188
189static const cc_string prefix = String_FromConst("hotkey-");
190static void StoredHotkey_Parse(cc_string* key, cc_string* value) {

Callers 1

HandleHotkeyDownFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected