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

Function glfw_mouse_button_callback

leif.c:1522–1540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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;
1525 // Changing the buttons array to resamble the state of the mouse
1526 if(action != GLFW_RELEASE) {
1527 if(!state.input.mouse.buttons_current[button])
1528 state.input.mouse.buttons_current[button] = true;
1529 } else {
1530 state.input.mouse.buttons_current[button] = false;
1531 }
1532 // Calling user defined callbacks
1533 for(uint32_t i = 0; i < state.input.mouse_button_cb_count; i++) {
1534 state.input.mouse_button_cbs[i](window, button, action, mods);
1535 }
1536 // Populating the mouse button event
1537 state.mb_ev.happened = true;
1538 state.mb_ev.pressed = action != GLFW_RELEASE;
1539 state.mb_ev.button_code = button;
1540}
1541void glfw_scroll_callback(GLFWwindow* window, double xoffset, double yoffset) {
1542 (void)window;
1543 // Setting the scroll values

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected