change node children from unique to shared ptr, rename Canvas2D to StrokePreview, add panel toolbar with icon buttons to toggle

This commit is contained in:
2017-03-25 17:28:57 +00:00
parent 4da0c3696a
commit a1e3fd4ecf
15 changed files with 216 additions and 65 deletions

View File

@@ -116,7 +116,7 @@ static int engine_init_display(struct engine* engine) {
surface = eglCreateWindowSurface(display, config, engine->app->window, NULL);
const EGLint attribs_test[] = {
EGL_CONTEXT_CLIENT_VERSION, 3,
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
@@ -199,26 +199,34 @@ static int32_t engine_handle_input(struct android_app* app, AInputEvent* event)
struct engine* engine = (struct engine*)app->userData;
float x = AMotionEvent_getX(event, 0);
float y = AMotionEvent_getY(event, 0);
LOG("event source: %d", AInputEvent_getSource(event));
MouseEvent e;
int32_t eventType = AInputEvent_getType(event);
switch (eventType) {
case AINPUT_EVENT_TYPE_MOTION:
switch (AInputEvent_getSource(event)) {
case AINPUT_SOURCE_TOUCHSCREEN:
int action = AKeyEvent_getAction(event) & AMOTION_EVENT_ACTION_MASK;
switch (action) {
case AMOTION_EVENT_ACTION_DOWN:
App::I.mouse_down(0, x, y);
return 1;
case AMOTION_EVENT_ACTION_UP:
App::I.mouse_up(0, x, y);
return 1;
case AMOTION_EVENT_ACTION_MOVE:
App::I.mouse_move(x, y);
return 1;
}
// switch (AInputEvent_getSource(event)) {
// case AINPUT_SOURCE_STYLUS:
// case AINPUT_SOURCE_TOUCHSCREEN:
{
int action = AKeyEvent_getAction(event) & AMOTION_EVENT_ACTION_MASK;
switch (action) {
case AMOTION_EVENT_ACTION_DOWN:
App::I.mouse_down(0, x, y);
return 1;
case AMOTION_EVENT_ACTION_UP:
App::I.mouse_up(0, x, y);
return 1;
case AMOTION_EVENT_ACTION_HOVER_MOVE: // pen move before touching
case AMOTION_EVENT_ACTION_MOVE:
App::I.mouse_move(x, y);
return 1;
default:
LOG("motion action: %d", action);
break;
} // end switch
}
}
// break;
// } // end switch
break;
case AINPUT_EVENT_TYPE_KEY:
// handle key input...
@@ -260,6 +268,7 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) {
engine->accelerometerSensor,
(1000L/60)*1000);
}
engine->animating = 1;
break;
case APP_CMD_LOST_FOCUS:
// When our app loses focus, we stop monitoring the accelerometer.