From 538cb1cd010a3323ad61239a12a4134ef4dceca6 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 24 Feb 2020 10:28:41 +0800 Subject: *camera --- src/extern/wog.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/extern/wog.c') 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; } -- cgit v1.1-26-g67d0