diff options
author | chai <chaifix@163.com> | 2020-02-24 10:28:41 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-02-24 10:28:41 +0800 |
commit | 538cb1cd010a3323ad61239a12a4134ef4dceca6 (patch) | |
tree | 0a2c492ce5d27c77da039aa5189b67aa3070aa20 /src/extern | |
parent | b656c9415a8e7e3b5b7d8bf1f3c8a5444f830c79 (diff) |
*camera
Diffstat (limited to 'src/extern')
-rw-r--r-- | src/extern/wog.c | 18 | ||||
-rw-r--r-- | src/extern/wog.h | 6 |
2 files changed, 19 insertions, 5 deletions
diff --git a/src/extern/wog.c b/src/extern/wog.c index 6cdfb6f..28d4dd1 100644 --- a/src/extern/wog.c +++ b/src/extern/wog.c @@ -131,6 +131,8 @@ void wog_handleEvent(wog_Window* window, MSG* msg, wog_Event* e) zero_mem(e, sizeof(wog_Event)); e->type = WOG_EMOUSEBUTTONDOWN; e->button = WOG_MOUSE_LBUTTON; + wog_getMouse(window, &e->pos.x, &e->pos.y); + SetCapture(hWnd); return ; } @@ -139,6 +141,8 @@ void wog_handleEvent(wog_Window* window, MSG* msg, wog_Event* e) zero_mem(e, sizeof(wog_Event)); e->type = WOG_EMOUSEBUTTONDOWN; e->button = WOG_MOUSE_RBUTTON; + wog_getMouse(window, &e->pos.x, &e->pos.y); + SetCapture(hWnd); return ; } @@ -147,6 +151,8 @@ void wog_handleEvent(wog_Window* window, MSG* msg, wog_Event* e) zero_mem(e, sizeof(wog_Event)); e->type = WOG_EMOUSEBUTTONDOWN; e->button = WOG_MOUSE_MIDDLE; + wog_getMouse(window, &e->pos.x, &e->pos.y); + SetCapture(hWnd); return ; } @@ -155,6 +161,8 @@ void wog_handleEvent(wog_Window* window, MSG* msg, wog_Event* e) zero_mem(e, sizeof(wog_Event)); e->type = WOG_EMOUSEBUTTONUP; e->button = WOG_MOUSE_LBUTTON; + wog_getMouse(window, &e->pos.x, &e->pos.y); + ReleaseCapture(); return ; } @@ -163,6 +171,8 @@ void wog_handleEvent(wog_Window* window, MSG* msg, wog_Event* e) zero_mem(e, sizeof(wog_Event)); e->type = WOG_EMOUSEBUTTONUP; e->button = WOG_MOUSE_RBUTTON; + wog_getMouse(window, &e->pos.x, &e->pos.y); + ReleaseCapture(); return ; } @@ -171,6 +181,8 @@ void wog_handleEvent(wog_Window* window, MSG* msg, wog_Event* e) zero_mem(e, sizeof(wog_Event)); e->type = WOG_EMOUSEBUTTONUP; e->button = WOG_MOUSE_MIDDLE; + wog_getMouse(window, &e->pos.x, &e->pos.y); + ReleaseCapture(); return ; } @@ -626,8 +638,10 @@ void wog_getMouse(wog_Window* wnd, int *x, int *y) ScreenToClient(wnd->hwnd, &p); int w, h; wog_getwindowsize(wnd, &w, &h); - *x = clamp(p.x, 0, w); - *y = clamp(p.y, 0, h); + //*x = clamp(p.x, 0, w); + //*y = clamp(p.y, 0, h); + *x = p.x; + *y = p.y; } diff --git a/src/extern/wog.h b/src/extern/wog.h index f616d82..ba11556 100644 --- a/src/extern/wog.h +++ b/src/extern/wog.h @@ -42,8 +42,8 @@ enum // mouse button event, e.button value typedef struct wog_Event { int type; - union // event value - { + //union // event value + //{ int key; // for key, simply use windows virtual key value // see https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx struct // for mouse motion @@ -52,7 +52,7 @@ typedef struct wog_Event }pos; int wheel; // 1 indicate scroll up and -1 indicate scrool down int button; // mouse button - }; + //}; }wog_Event; typedef struct { |