aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_convert_keycode.c
blob: 01d315cc86f95bca5ce406b22ca6777637e30402 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_convert_keycode.c                               :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/17 19:00:20 by rbousset          #+#    #+#             */
/*   Updated: 2020/02/17 19:00:21 by rbousset         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#include <cub3d.h>
#include <stdint.h>

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);
}