diff options
author | chai <chaifix@163.com> | 2020-07-10 23:11:10 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-07-10 23:11:10 +0800 |
commit | 21bd7a08615b388bc536d3ffb1e3efce7e5f7673 (patch) | |
tree | f99133d42d83ce49966fb3c05ba8d0bcc0fd1d47 /src/extend/camera.c | |
parent | e5e5295ed38cb24feb5ee6f827b2765a4153bfc8 (diff) |
*icon
Diffstat (limited to 'src/extend/camera.c')
-rw-r--r-- | src/extend/camera.c | 22 |
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) |