#include "include/input.h" void honey_setup_keyboard() { memset(honey_key_states, 0, sizeof(honey_key_states)); memset(honey_key_callbacks, 0, sizeof(honey_key_callbacks)); memset(honey_key_callbacks_data, 0, sizeof(honey_key_callbacks_data)); honey_keyboard_callback = &default_honey_keyboard_callback; } /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ bool honey_key_down(int key) { if (key < 0 || key >= HONEY_N_KEYS) { return false; } return (bool) honey_key_states[key]; } /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ void honey_key_bind(int key, void (*callback)(void*, int), void* data) { if (key >= 0 && key < HONEY_N_KEYS) { honey_key_callbacks[key] = callback; honey_key_callbacks_data[key] = data; } } /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ void honey_key_unbind(int key) { if (key >=0 && key < HONEY_N_KEYS) { honey_key_callbacks[key] = NULL; honey_key_callbacks_data[key] = NULL; } } /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ void honey_key_unbind_all() { for (int i=0; i