diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2021-07-03 00:49:03 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-03-30 08:20:20 +0200 |
| commit | 8c10334252821b6310cf744218f7ad8bed7917f2 (patch) | |
| tree | f6f11d71eac56fa834783ef54a977b80f2e5efc2 /src/camera/inc | |
| parent | fc9beffe0103a80bf883f85b7ae09dc42b7af50e (diff) | |
| download | rts-8c10334252821b6310cf744218f7ad8bed7917f2.tar.gz | |
Add project source code
Diffstat (limited to 'src/camera/inc')
| -rw-r--r-- | src/camera/inc/camera.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/camera/inc/camera.h b/src/camera/inc/camera.h new file mode 100644 index 0000000..1daebd2 --- /dev/null +++ b/src/camera/inc/camera.h @@ -0,0 +1,42 @@ +#ifndef CAMERA_H +#define CAMERA_H + +#include <pad.h> +#include <util.h> +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct camera +{ + int x, y, x_speed, y_speed; + unsigned int xt, yt; + + struct cursor + { + unsigned int x, y, x_init, y_init; + enum + { + CURSOR_STATE_IDLE, + CURSOR_STATE_PRESSED + } state; + } cursor; +}; + +extern struct sprite cursor_sprite; + +void camera_update(struct camera *cam, const struct pad *p); +bool camera_translate(const struct camera *cam, const struct util_rect *dim, short *x, short *y); +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); +int cursor_render(const struct cursor *c); + +#ifdef __cplusplus +} +#endif + +#endif /* CAMERA_H */ |
