input.h 785 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #pragma once
  2. #include <stdint.h>
  3. #include <stdbool.h>
  4. #include <switch/services/hid.h>
  5. typedef struct
  6. {
  7. uint64_t down;
  8. uint64_t held;
  9. uint64_t up;
  10. int32_t t_count;
  11. HidTouchState t_pos;
  12. } input_t;
  13. void init_input(void);
  14. //
  15. input_t get_input(void);
  16. // this is used to check if the user was already touching the screen when entering a function that checks for screen touches.
  17. // this is useful to know whether to lock touching until the user touches the screen again.
  18. bool is_touch(void);
  19. //
  20. int check_if_touch_yesno(const input_t *input);
  21. //
  22. bool check_if_touch_error(void);
  23. //
  24. int check_if_option(const input_t *input);
  25. //
  26. uint32_t move_cursor_up(uint32_t cursor, uint32_t cursor_max);
  27. //
  28. uint32_t move_cursor_down(uint32_t cursor, uint32_t cursor_max);