/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_convert_keycode.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: joelecle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/17 19:00:20 by joelecle #+# #+# */ /* Updated: 2020/02/17 19:00:21 by joelecle ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include int32_t ft_convert_keycode(const int32_t tmp_code) { uint16_t keycode; keycode = UINT16_MAX; keycode = (tmp_code == FT_W_KEY) ? (0) : (keycode); keycode = (tmp_code == FT_A_KEY) ? (1) : (keycode); keycode = (tmp_code == FT_S_KEY) ? (2) : (keycode); keycode = (tmp_code == FT_D_KEY) ? (3) : (keycode); keycode = (tmp_code == FT_L_ARR_KEY) ? (4) : (keycode); keycode = (tmp_code == FT_R_ARR_KEY) ? (5) : (keycode); keycode = (tmp_code == 3) ? (UINT16_MAX) : (keycode); keycode = (tmp_code == 4) ? (UINT16_MAX) : (keycode); keycode = (tmp_code == 5) ? (UINT16_MAX) : (keycode); keycode = (tmp_code == FT_ESC_KEY) ? (FT_ESC_KEY) : (keycode); keycode = (tmp_code == FT_F1_KEY) ? (FT_F1_KEY) : (keycode); keycode = (tmp_code == FT_TAB_KEY) ? (FT_TAB_KEY) : (keycode); keycode = (tmp_code == FT_RET_KEY) ? (FT_RET_KEY) : (keycode); keycode = (tmp_code == FT_SPC_KEY) ? (FT_SPC_KEY) : (keycode); keycode = (tmp_code == FT_ONE_KEY) ? (FT_ONE_KEY) : (keycode); keycode = (tmp_code == FT_TWO_KEY) ? (FT_TWO_KEY) : (keycode); keycode = (tmp_code == FT_THREE_KEY) ? (FT_THREE_KEY) : (keycode); return (keycode); }