true 16-bit color... glorious

This commit is contained in:
asrael 2025-11-28 14:41:35 -06:00
parent 3dccce8a81
commit b1e8525c3e
30 changed files with 678 additions and 652 deletions

View file

@ -120,6 +120,8 @@ static i32 pxl8_key_code(const char* key_name) {
{"left", 80}, {"right", 79}, {"up", 82}, {"down", 81},
{"f1", 58}, {"f2", 59}, {"f3", 60}, {"f4", 61}, {"f5", 62}, {"f6", 63},
{"f7", 64}, {"f8", 65}, {"f9", 66}, {"f10", 67}, {"f11", 68}, {"f12", 69},
{"capslock", 57}, {"lshift", 225}, {"rshift", 229},
{"lctrl", 224}, {"rctrl", 228}, {"lalt", 226}, {"ralt", 230},
{NULL, 0}
};
@ -142,21 +144,21 @@ static i32 pxl8_key_code(const char* key_name) {
bool pxl8_key_down(const pxl8_input_state* input, const char* key_name) {
if (!input) return false;
i32 key = pxl8_key_code(key_name);
if (key < 0 || key >= 256) return false;
if (key < 0 || key >= PXL8_MAX_KEYS) return false;
return input->keys_down[key];
}
bool pxl8_key_pressed(const pxl8_input_state* input, const char* key_name) {
if (!input) return false;
i32 key = pxl8_key_code(key_name);
if (key < 0 || key >= 256) return false;
if (key < 0 || key >= PXL8_MAX_KEYS) return false;
return input->keys_pressed[key];
}
bool pxl8_key_released(const pxl8_input_state* input, const char* key_name) {
if (!input) return false;
i32 key = pxl8_key_code(key_name);
if (key < 0 || key >= 256) return false;
if (key < 0 || key >= PXL8_MAX_KEYS) return false;
return input->keys_released[key];
}