From 0b94264a7e5e7c8c1a56f8bba3cbe7a5a63cd38b Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Fri, 24 Jun 2022 17:45:50 +0200 Subject: camera: implement fixed cursor movement On platforms with PERIPHERAL_TYPE_PAD, navigating through menus and options can be cumbersome if moving the cursor freely around the screen. Therefore, this commit instead defines a list of (X, Y) coordinates that the cursor can jump to. The implementation also attempts to guess which direction the cursor should jump to for the previous/next point, and hence determine which button should be pressed by the user. --- src/camera/inc/camera.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/camera/inc') diff --git a/src/camera/inc/camera.h b/src/camera/inc/camera.h index 98cb240..9841315 100644 --- a/src/camera/inc/camera.h +++ b/src/camera/inc/camera.h @@ -35,6 +35,16 @@ struct camera { int last_w, last_h; } screen; + + struct cursor_pos_rt + { + const struct cursor_pos + { + unsigned x, y; + } *list; + + size_t i, n; + } rt; } cursor; }; @@ -45,6 +55,7 @@ bool camera_translate(const struct camera *cam, const struct util_rect *dim, sho void cursor_init(struct cursor *c); bool cursor_collision(const struct camera *cam, const struct util_rect *d); void cursor_pos(const struct camera *cam, unsigned long *x, unsigned long *y); +void cursor_set_pos_list(struct cursor *c, const struct cursor_pos *pos, size_t n); int cursor_render(const struct cursor *c); #ifdef __cplusplus -- cgit v1.2.3