aboutsummaryrefslogtreecommitdiff
path: root/src/camera/inc/camera.h
blob: 151ea740b2e3d7af6faecb0b1d25df52d4d7d0c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#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;
        struct
        {
            int last_w, last_h;
        } screen;
    } 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 */