fix log thread bug, add clean memory button, fix pinch zoom bug, set android back button to undo

This commit is contained in:
2017-05-12 13:31:56 +01:00
parent 6dbb8bf3a1
commit 51e355d039
13 changed files with 72 additions and 17 deletions

View File

@@ -7,7 +7,7 @@ kKey convert_key(int android_key)
CASE(AKEYCODE_SOFT_LEFT, kKey::Unknown);
CASE(AKEYCODE_SOFT_RIGHT, kKey::Unknown);
CASE(AKEYCODE_HOME, kKey::AndroidHome);
CASE(AKEYCODE_BACK, kKey::Unknown);
CASE(AKEYCODE_BACK, kKey::AndroidBack);
CASE(AKEYCODE_CALL, kKey::Unknown);
CASE(AKEYCODE_ENDCALL, kKey::Unknown);
CASE(AKEYCODE_0, kKey::Unknown);

View File

@@ -406,11 +406,11 @@ static int32_t engine_handle_input(struct android_app* app, AInputEvent* event)
switch (action) {
case AMOTION_EVENT_ACTION_DOWN:
{
float y = AMotionEvent_getY(event, 0);
float x = AMotionEvent_getX(event, 0);
float y = AMotionEvent_getY(event, 0);
p0.id = AMotionEvent_getPointerId(event, 0);
p0.pos = {x, y};
p0.idx = index;
p0.idx = index;
App::I.mouse_down(0, x, y);
tracked = 1;
//LOG("first down");
@@ -421,15 +421,18 @@ static int32_t engine_handle_input(struct android_app* app, AInputEvent* event)
//LOG("pointer down index %d", index);
if (count == 2)
{
float y = AMotionEvent_getY(event, 1);
float x = AMotionEvent_getX(event, 1);
float y = AMotionEvent_getY(event, 1);
p1.id = AMotionEvent_getPointerId(event, 1);
p1.idx = index;
p1.pos = {x, y};
tracked = 2;
p0.pos.x = AMotionEvent_getX(event, 0);
p0.pos.y = AMotionEvent_getY(event, 0);
//LOG("second down");
App::I.mouse_cancel(0);
if (tracked == 1)
App::I.mouse_cancel(0);
App::I.gesture_start(p0.pos, p1.pos);
tracked = 2;
}
return 1;
}
@@ -500,9 +503,19 @@ static int32_t engine_handle_input(struct android_app* app, AInputEvent* event)
break;
case AINPUT_EVENT_TYPE_KEY:
{
int action = AKeyEvent_getAction(event);
int32_t key_val = AKeyEvent_getKeyCode(event);
LOG("Received key event: %d\n", key_val);
App::I.key_down(convert_key(key_val));
switch (action)
{
case AKEY_EVENT_ACTION_DOWN:
LOG("Received key down event: %d\n", key_val);
App::I.key_down(convert_key(key_val));
break;
case AKEY_EVENT_ACTION_UP:
LOG("Received key up event: %d\n", key_val);
App::I.key_up(convert_key(key_val));
break;
}
return 1;
}
} // end switch