From b56df6d28c5c41bc0525cf259f095e5231d8096b Mon Sep 17 00:00:00 2001 From: folecr Date: Mon, 29 Jul 2013 17:14:36 -0700 Subject: [PATCH] Separate log macro for logging event processing --- cocos2dx/platform/android/nativeactivity.cpp | 31 +++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/cocos2dx/platform/android/nativeactivity.cpp b/cocos2dx/platform/android/nativeactivity.cpp index 02cb7c5364..f5f40c068b 100644 --- a/cocos2dx/platform/android/nativeactivity.cpp +++ b/cocos2dx/platform/android/nativeactivity.cpp @@ -21,7 +21,10 @@ #define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "cocos2dx/nativeactivity.cpp", __VA_ARGS__)) #define LOG_RENDER_DEBUG(...) -// #define LOG_RENDER_DEBUG(...) ((void)__android_log_print(ANDROID_LOG_WARN, "cocos2dx/nativeactivity.cpp", __VA_ARGS__)) +// #define LOG_RENDER_DEBUG(...) ((void)__android_log_print(ANDROID_LOG_INFO, "cocos2dx/nativeactivity.cpp", __VA_ARGS__)) + +#define LOG_EVENTS_DEBUG(...) +// #define LOG_EVENTS_DEBUG(...) ((void)__android_log_print(ANDROID_LOG_INFO, "cocos2dx/nativeactivity.cpp", __VA_ARGS__)) /** * Our saved state data. @@ -237,19 +240,19 @@ static void getTouchPos(AInputEvent *event, int ids[], float xs[], float ys[]) { static int32_t handle_touch_input(AInputEvent *event) { pthread_t thisthread = pthread_self(); - LOGI("handle_touch_input(%X), pthread_self() = %X", event, thisthread); + LOG_EVENTS_DEBUG("handle_touch_input(%X), pthread_self() = %X", event, thisthread); switch(AMotionEvent_getAction(event) & AMOTION_EVENT_ACTION_MASK) { case AMOTION_EVENT_ACTION_DOWN: { - LOGI("AMOTION_EVENT_ACTION_DOWN"); + LOG_EVENTS_DEBUG("AMOTION_EVENT_ACTION_DOWN"); int pointerId = AMotionEvent_getPointerId(event, 0); float xP = AMotionEvent_getX(event,0); float yP = AMotionEvent_getY(event,0); - LOGI("Event: Action DOWN x=%f y=%f pointerID=%d\n", + LOG_EVENTS_DEBUG("Event: Action DOWN x=%f y=%f pointerID=%d\n", xP, yP, pointerId); int pId = pointerId; float x = xP; @@ -262,13 +265,13 @@ static int32_t handle_touch_input(AInputEvent *event) { case AMOTION_EVENT_ACTION_POINTER_DOWN: { - LOGI("AMOTION_EVENT_ACTION_POINTER_DOWN"); + LOG_EVENTS_DEBUG("AMOTION_EVENT_ACTION_POINTER_DOWN"); int pointerIndex = AMotionEvent_getAction(event) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; int pointerId = AMotionEvent_getPointerId(event, pointerIndex); float xP = AMotionEvent_getX(event,pointerIndex); float yP = AMotionEvent_getY(event,pointerIndex); - LOGI("Event: Action POINTER DOWN x=%f y=%f pointerID=%d\n", + LOG_EVENTS_DEBUG("Event: Action POINTER DOWN x=%f y=%f pointerID=%d\n", xP, yP, pointerId); int pId = pointerId; float x = xP; @@ -281,7 +284,7 @@ static int32_t handle_touch_input(AInputEvent *event) { case AMOTION_EVENT_ACTION_MOVE: { - LOGI("AMOTION_EVENT_ACTION_MOVE"); + LOG_EVENTS_DEBUG("AMOTION_EVENT_ACTION_MOVE"); int pointerCount = AMotionEvent_getPointerCount(event); int ids[pointerCount]; float xs[pointerCount], ys[pointerCount]; @@ -293,11 +296,11 @@ static int32_t handle_touch_input(AInputEvent *event) { case AMOTION_EVENT_ACTION_UP: { - LOGI("AMOTION_EVENT_ACTION_UP"); + LOG_EVENTS_DEBUG("AMOTION_EVENT_ACTION_UP"); int pointerId = AMotionEvent_getPointerId(event, 0); float xP = AMotionEvent_getX(event,0); float yP = AMotionEvent_getY(event,0); - LOGI("Event: Action UP x=%f y=%f pointerID=%d\n", + LOG_EVENTS_DEBUG("Event: Action UP x=%f y=%f pointerID=%d\n", xP, yP, pointerId); int pId = pointerId; float x = xP; @@ -310,12 +313,12 @@ static int32_t handle_touch_input(AInputEvent *event) { case AMOTION_EVENT_ACTION_POINTER_UP: { - LOGI("AMOTION_EVENT_ACTION_POINTER_UP"); + LOG_EVENTS_DEBUG("AMOTION_EVENT_ACTION_POINTER_UP"); int pointerIndex = AMotionEvent_getAction(event) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; int pointerId = AMotionEvent_getPointerId(event, pointerIndex); float xP = AMotionEvent_getX(event,pointerIndex); float yP = AMotionEvent_getY(event,pointerIndex); - LOGI("Event: Action POINTER UP x=%f y=%f pointerID=%d\n", + LOG_EVENTS_DEBUG("Event: Action POINTER UP x=%f y=%f pointerID=%d\n", xP, yP, pointerIndex); int pId = pointerId; float x = xP; @@ -328,7 +331,7 @@ static int32_t handle_touch_input(AInputEvent *event) { case AMOTION_EVENT_ACTION_CANCEL: { - LOGI("AMOTION_EVENT_ACTION_CANCEL"); + LOG_EVENTS_DEBUG("AMOTION_EVENT_ACTION_CANCEL"); int pointerCount = AMotionEvent_getPointerCount(event); int ids[pointerCount]; float xs[pointerCount], ys[pointerCount]; @@ -339,7 +342,7 @@ static int32_t handle_touch_input(AInputEvent *event) { break; default: - LOGI("handle_touch_input() default case.... NOT HANDLE"); + LOG_EVENTS_DEBUG("handle_touch_input() default case.... NOT HANDLE"); return 0; break; } @@ -351,7 +354,7 @@ static int32_t handle_touch_input(AInputEvent *event) { static int32_t engine_handle_input(struct android_app* app, AInputEvent* event) { pthread_t thisthread = pthread_self(); - LOGI("engine_handle_input(%X, %X), pthread_self() = %X", app, event, thisthread); + LOG_EVENTS_DEBUG("engine_handle_input(%X, %X), pthread_self() = %X", app, event, thisthread); struct engine* engine = (struct engine*)app->userData; if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION) {