diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-03-09 17:46:09 +0100 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-03-30 08:20:21 +0200 |
| commit | eccba7c2afebf83ecfd0a76b9d358303ae773843 (patch) | |
| tree | 1ec78495c69d032ee5374e0f551ecb53a3f72311 /src | |
| parent | aa355c0c0a49aa401432acb5aaf560230e56ca2d (diff) | |
| download | jancity-eccba7c2afebf83ecfd0a76b9d358303ae773843.tar.gz | |
Move CURSOR_{WIDTH|HEIGHT} to library scope
Diffstat (limited to 'src')
| -rw-r--r-- | src/camera/privinc/camera_private.h | 6 | ||||
| -rw-r--r-- | src/camera/src/camera.c | 20 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/camera/privinc/camera_private.h b/src/camera/privinc/camera_private.h index f571f2d..b9f4773 100644 --- a/src/camera/privinc/camera_private.h +++ b/src/camera/privinc/camera_private.h @@ -8,6 +8,12 @@ extern "C" { #endif +enum +{ + CAMERA_CURSOR_WIDTH = 20, + CAMERA_CURSOR_HEIGHT = 20 +}; + void camera_update_pos(struct camera *cam); #ifdef __cplusplus diff --git a/src/camera/src/camera.c b/src/camera/src/camera.c index 21c18c7..4cc164c 100644 --- a/src/camera/src/camera.c +++ b/src/camera/src/camera.c @@ -10,12 +10,6 @@ struct sprite cursor_sprite; -enum -{ - CURSOR_WIDTH = 20, - CURSOR_HEIGHT = 20 -}; - bool cursor_collision(const struct camera *const cam, const struct util_rect *const d) { unsigned long x, y; @@ -26,8 +20,8 @@ bool cursor_collision(const struct camera *const cam, const struct util_rect *co { .x = x, .y = y, - .w = CURSOR_WIDTH / 4, - .h = CURSOR_HEIGHT / 4 + .w = CAMERA_CURSOR_WIDTH / 4, + .h = CAMERA_CURSOR_HEIGHT / 4 }; return util_collision(d, &cd); @@ -51,13 +45,13 @@ int cursor_render(const struct cursor *const c) s->x = c->x; s->y = c->y; - s->w = CURSOR_WIDTH; - s->h = CURSOR_HEIGHT; + s->w = CAMERA_CURSOR_WIDTH; + s->h = CAMERA_CURSOR_HEIGHT; switch (c->state) { case CURSOR_STATE_IDLE: - s->u += CURSOR_WIDTH; + s->u += CAMERA_CURSOR_WIDTH; break; case CURSOR_STATE_PRESSED: @@ -70,8 +64,8 @@ int cursor_render(const struct cursor *const c) void cursor_init(struct cursor *const c) { - c->x = c->x_init = (screen_w / 2) - CURSOR_WIDTH; - c->y = c->y_init = (screen_h / 2) - CURSOR_HEIGHT; + c->x = c->x_init = (screen_w / 2) - CAMERA_CURSOR_WIDTH; + c->y = c->y_init = (screen_h / 2) - CAMERA_CURSOR_HEIGHT; c->screen.last_w = screen_w; c->screen.last_h = screen_h; } |
