aboutsummaryrefslogtreecommitdiff
path: root/src/camera/inc
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2021-07-03 00:49:03 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-03-30 08:20:20 +0200
commit6b9f686913efc3725b2690033cd4f398e07076ba (patch)
treee9aa91a6b9f617d78123ebe7ad272fc42a60d306 /src/camera/inc
parentc9e6ae44a9aeb89b3f48f3443d6baa80103f7445 (diff)
downloadjancity-6b9f686913efc3725b2690033cd4f398e07076ba.tar.gz
Add project source code
Diffstat (limited to 'src/camera/inc')
-rw-r--r--src/camera/inc/camera.h42
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 */