diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2008-11-24 17:16:04 +0300 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2008-11-24 17:16:04 +0300 |
commit | 0c625e20ad070560ce4ea8fb78096a3119a8357e (patch) | |
tree | ee6f51b7135a26600063c819560a1f9676594721 /source | |
parent | b863bf98e53a709e3353e80d87f574f860187cdb (diff) |
* make sure this compiles with msvc too.
- note: there is no round() in msvc math.h, so I used floor(val+0.5)
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/windowmanager/intern/wm_gesture.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index a28eedc631e..618d430b4bd 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -26,6 +26,7 @@ * ***** END GPL LICENSE BLOCK ***** */ +#define _USE_MATH_DEFINES #include <math.h> #include "DNA_screen_types.h" @@ -48,6 +49,7 @@ #include "BIF_gl.h" #include "BIF_glutil.h" + /* context checked on having screen, window and area */ wmGesture *WM_gesture_new(bContext *C, wmEvent *event, int type) { @@ -97,7 +99,7 @@ int wm_gesture_evaluate(bContext *C, wmGesture *gesture) int dx= rect->xmax - rect->xmin; int dy= rect->ymax - rect->ymin; if(ABS(dx)+ABS(dy) > TWEAK_THRESHOLD) { - int theta= (int)round(4.0f*atan2((float)dy, (float)dx)/M_PI); + int theta= (int)floor(4.0f*atan2((float)dy, (float)dx)/M_PI + 0.5); int val= EVT_GESTURE_W; if(theta==0) val= EVT_GESTURE_E; |