mirror of https://github.com/axmolengine/axmol.git
Separate log macro for logging event processing
This commit is contained in:
parent
5889cc2218
commit
b56df6d28c
|
@ -21,7 +21,10 @@
|
||||||
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "cocos2dx/nativeactivity.cpp", __VA_ARGS__))
|
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "cocos2dx/nativeactivity.cpp", __VA_ARGS__))
|
||||||
|
|
||||||
#define LOG_RENDER_DEBUG(...)
|
#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.
|
* 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) {
|
static int32_t handle_touch_input(AInputEvent *event) {
|
||||||
|
|
||||||
pthread_t thisthread = pthread_self();
|
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) &
|
switch(AMotionEvent_getAction(event) &
|
||||||
AMOTION_EVENT_ACTION_MASK) {
|
AMOTION_EVENT_ACTION_MASK) {
|
||||||
|
|
||||||
case AMOTION_EVENT_ACTION_DOWN:
|
case AMOTION_EVENT_ACTION_DOWN:
|
||||||
{
|
{
|
||||||
LOGI("AMOTION_EVENT_ACTION_DOWN");
|
LOG_EVENTS_DEBUG("AMOTION_EVENT_ACTION_DOWN");
|
||||||
int pointerId = AMotionEvent_getPointerId(event, 0);
|
int pointerId = AMotionEvent_getPointerId(event, 0);
|
||||||
float xP = AMotionEvent_getX(event,0);
|
float xP = AMotionEvent_getX(event,0);
|
||||||
float yP = AMotionEvent_getY(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);
|
xP, yP, pointerId);
|
||||||
int pId = pointerId;
|
int pId = pointerId;
|
||||||
float x = xP;
|
float x = xP;
|
||||||
|
@ -262,13 +265,13 @@ static int32_t handle_touch_input(AInputEvent *event) {
|
||||||
|
|
||||||
case AMOTION_EVENT_ACTION_POINTER_DOWN:
|
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 pointerIndex = AMotionEvent_getAction(event) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
|
||||||
int pointerId = AMotionEvent_getPointerId(event, pointerIndex);
|
int pointerId = AMotionEvent_getPointerId(event, pointerIndex);
|
||||||
float xP = AMotionEvent_getX(event,pointerIndex);
|
float xP = AMotionEvent_getX(event,pointerIndex);
|
||||||
float yP = AMotionEvent_getY(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);
|
xP, yP, pointerId);
|
||||||
int pId = pointerId;
|
int pId = pointerId;
|
||||||
float x = xP;
|
float x = xP;
|
||||||
|
@ -281,7 +284,7 @@ static int32_t handle_touch_input(AInputEvent *event) {
|
||||||
|
|
||||||
case AMOTION_EVENT_ACTION_MOVE:
|
case AMOTION_EVENT_ACTION_MOVE:
|
||||||
{
|
{
|
||||||
LOGI("AMOTION_EVENT_ACTION_MOVE");
|
LOG_EVENTS_DEBUG("AMOTION_EVENT_ACTION_MOVE");
|
||||||
int pointerCount = AMotionEvent_getPointerCount(event);
|
int pointerCount = AMotionEvent_getPointerCount(event);
|
||||||
int ids[pointerCount];
|
int ids[pointerCount];
|
||||||
float xs[pointerCount], ys[pointerCount];
|
float xs[pointerCount], ys[pointerCount];
|
||||||
|
@ -293,11 +296,11 @@ static int32_t handle_touch_input(AInputEvent *event) {
|
||||||
|
|
||||||
case AMOTION_EVENT_ACTION_UP:
|
case AMOTION_EVENT_ACTION_UP:
|
||||||
{
|
{
|
||||||
LOGI("AMOTION_EVENT_ACTION_UP");
|
LOG_EVENTS_DEBUG("AMOTION_EVENT_ACTION_UP");
|
||||||
int pointerId = AMotionEvent_getPointerId(event, 0);
|
int pointerId = AMotionEvent_getPointerId(event, 0);
|
||||||
float xP = AMotionEvent_getX(event,0);
|
float xP = AMotionEvent_getX(event,0);
|
||||||
float yP = AMotionEvent_getY(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);
|
xP, yP, pointerId);
|
||||||
int pId = pointerId;
|
int pId = pointerId;
|
||||||
float x = xP;
|
float x = xP;
|
||||||
|
@ -310,12 +313,12 @@ static int32_t handle_touch_input(AInputEvent *event) {
|
||||||
|
|
||||||
case AMOTION_EVENT_ACTION_POINTER_UP:
|
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 pointerIndex = AMotionEvent_getAction(event) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
|
||||||
int pointerId = AMotionEvent_getPointerId(event, pointerIndex);
|
int pointerId = AMotionEvent_getPointerId(event, pointerIndex);
|
||||||
float xP = AMotionEvent_getX(event,pointerIndex);
|
float xP = AMotionEvent_getX(event,pointerIndex);
|
||||||
float yP = AMotionEvent_getY(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);
|
xP, yP, pointerIndex);
|
||||||
int pId = pointerId;
|
int pId = pointerId;
|
||||||
float x = xP;
|
float x = xP;
|
||||||
|
@ -328,7 +331,7 @@ static int32_t handle_touch_input(AInputEvent *event) {
|
||||||
|
|
||||||
case AMOTION_EVENT_ACTION_CANCEL:
|
case AMOTION_EVENT_ACTION_CANCEL:
|
||||||
{
|
{
|
||||||
LOGI("AMOTION_EVENT_ACTION_CANCEL");
|
LOG_EVENTS_DEBUG("AMOTION_EVENT_ACTION_CANCEL");
|
||||||
int pointerCount = AMotionEvent_getPointerCount(event);
|
int pointerCount = AMotionEvent_getPointerCount(event);
|
||||||
int ids[pointerCount];
|
int ids[pointerCount];
|
||||||
float xs[pointerCount], ys[pointerCount];
|
float xs[pointerCount], ys[pointerCount];
|
||||||
|
@ -339,7 +342,7 @@ static int32_t handle_touch_input(AInputEvent *event) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOGI("handle_touch_input() default case.... NOT HANDLE");
|
LOG_EVENTS_DEBUG("handle_touch_input() default case.... NOT HANDLE");
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
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) {
|
static int32_t engine_handle_input(struct android_app* app, AInputEvent* event) {
|
||||||
|
|
||||||
pthread_t thisthread = pthread_self();
|
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;
|
struct engine* engine = (struct engine*)app->userData;
|
||||||
if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION) {
|
if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION) {
|
||||||
|
|
Loading…
Reference in New Issue