summaryrefslogtreecommitdiff
path: root/src/extend/camera.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/extend/camera.c')
-rw-r--r--src/extend/camera.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/extend/camera.c b/src/extend/camera.c
index 6b4c0d1..dd77172 100644
--- a/src/extend/camera.c
+++ b/src/extend/camera.c
@@ -2,6 +2,12 @@
#include "../core/device.h"
#include "camera.h"
+typedef enum {
+ CursorType_Arrow = 0,
+ CursorType_Hand = 1,
+ CursorType_Eye = 2
+}CursorType;
+
// A unity editor style camera
typedef struct Camera {
Transform transform;
@@ -23,6 +29,7 @@ typedef struct Camera {
bool move_around;
/*window*/
wog_Window* wnd;
+ CursorType cursor;
} Camera;
Camera* camera_create(wog_Window* wnd, CameraConfig* config) {
@@ -134,11 +141,21 @@ void camera_onevent(Camera* cam, wog_Event* e, float dt) {
cam->look_around = TRUE;
cam->mouse_prev.x = e->pos.x;
cam->mouse_prev.y = e->pos.y;
+ if (cam->cursor != CursorType_Eye)
+ {
+ wog_setcursorImage(cam->wnd, "OrbitView.ico");
+ cam->cursor = CursorType_Eye;
+ }
}
if (!cam->move_around && e->button == WOG_MOUSE_MIDDLE) {
cam->move_around = TRUE;
cam->mouse_prev.x = e->pos.x;
cam->mouse_prev.y = e->pos.y;
+ if (cam->cursor != CursorType_Hand)
+ {
+ wog_setcursorImage(cam->wnd, "PanView.ico");
+ cam->cursor = CursorType_Hand;
+ }
}
}
else if (e->type == WOG_EMOUSEBUTTONUP) {
@@ -146,6 +163,11 @@ void camera_onevent(Camera* cam, wog_Event* e, float dt) {
cam->look_around = FALSE;
if (e->button == WOG_MOUSE_MIDDLE)
cam->move_around = FALSE;
+ if (cam->cursor != CursorType_Arrow)
+ {
+ wog_setcursor(cam->wnd, IDC_ARROW);
+ cam->cursor = CursorType_Arrow;
+ }
}
else if (e->type == WOG_EKEYDOWN) {
if (!cam->speedup && e->key == VK_SHIFT)