Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. typedef struct s_exec
  2. {
  3. int value;
  4. void (*ft_get)(void);
  5. } t_exec;
  6.  
  7.  
  8. static void ft_exec_cmd(int input)
  9. {
  10. int i;
  11. t_exec ft_ptr[] =
  12. {
  13. {DELETE, &ft_del},
  14. {BACKSPACE, &ft_del},
  15. {SPACE, &ft_space},
  16. {UP, &ft_up},
  17. {DOWN, &ft_down},
  18. {RIGHT, &ft_right},
  19. {LEFT, &ft_left},
  20. {-1, NULL}
  21. };
  22.  
  23. i = 0;
  24. if (ft_check_window() == 1)
  25. return ;
  26. while (ft_ptr[i].value != -1)
  27. {
  28. if (ft_ptr[i].value == input)
  29. ft_ptr[i].ft_get();
  30. i++;
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement