MCPcopy Create free account
hub / github.com/cococry/leif / glfw_key_callback

Function glfw_key_callback

leif.c:1499–1521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1497
1498#ifdef LF_GLFW
1499void glfw_key_callback(GLFWwindow* window, int32_t key, int scancode, int action, int mods) {
1500 (void)window;
1501 (void)mods;
1502 (void)scancode;
1503 // Changing the the keys array to resamble the state of the keyboard
1504 if(action != GLFW_RELEASE) {
1505 if(!state.input.keyboard.keys[key])
1506 state.input.keyboard.keys[key] = true;
1507 } else {
1508 state.input.keyboard.keys[key] = false;
1509 }
1510 state.input.keyboard.keys_changed[key] = (action != GLFW_REPEAT);
1511
1512 // Calling user defined callbacks
1513 for(uint32_t i = 0; i < state.input.key_cb_count; i++) {
1514 state.input.key_cbs[i](window, key, scancode, action, mods);
1515 }
1516
1517 // Populating the key event
1518 state.key_ev.happened = true;
1519 state.key_ev.pressed = action != GLFW_RELEASE;
1520 state.key_ev.keycode = key;
1521}
1522void glfw_mouse_button_callback(GLFWwindow* window, int32_t button, int action, int mods) {
1523 (void)window;
1524 (void)mods;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected