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

Function KeyBindsScreen_TriggerBinding

src/Menus.c:2003–2024  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2001}
2002
2003static cc_bool KeyBindsScreen_TriggerBinding(int key, struct InputDevice* device) {
2004 struct KeyBindsScreen* s = &KeyBindsScreen;
2005 InputBind bind;
2006 int idx;
2007 if (device->type != bind_device->type) return false;
2008
2009 Input.DownHook = NULL;
2010 if (s->curI == -1) return false;
2011 bind = s->binds[s->curI];
2012
2013 if (key == device->escapeButton) {
2014 InputBind_Reset(bind, bind_device);
2015 } else {
2016 InputBind_Set(bind, key, bind_device);
2017 }
2018
2019 idx = s->curI;
2020 s->curI = -1;
2021 s->closable = true;
2022 KeyBindsScreen_Update(s, idx);
2023 return true;
2024}
2025
2026static void KeyBindsScreen_OnBindingClick(void* screen, void* widget) {
2027 struct KeyBindsScreen* s = (struct KeyBindsScreen*)screen;

Callers

nothing calls this directly

Calls 3

InputBind_ResetFunction · 0.85
InputBind_SetFunction · 0.85
KeyBindsScreen_UpdateFunction · 0.85

Tested by

no test coverage detected