diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-06-24 17:45:50 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-06-24 17:45:50 +0200 |
| commit | 0b94264a7e5e7c8c1a56f8bba3cbe7a5a63cd38b (patch) | |
| tree | 720c69b704752c406362407824176fcdd80825c3 /src/camera/inc | |
| parent | 904d9e933e59af8493865801584bf748255dc322 (diff) | |
| download | jancity-0b94264a7e5e7c8c1a56f8bba3cbe7a5a63cd38b.tar.gz | |
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.
Diffstat (limited to 'src/camera/inc')
| -rw-r--r-- | src/camera/inc/camera.h | 11 |
1 files changed, 11 insertions, 0 deletions
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 |
