void handleScreenEvent(bps_event_t *event) { screen_event_t screen_event = screen_event_get_event(event); int screen_val; screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &screen_val); mtouch_event_t mtouch_event; int rc = screen_get_mtouch_event(screen_event, &mtouch_event, 0); if (rc) { //fprintf(stderr, "Error: failed to get mtouch event\n"); } p = points.begin(); bool found; found = false; while (p != points.end()) { if (p->id == mtouch_event.contact_id) { found = true; break; } p++; } switch (screen_val) { case SCREEN_EVENT_MTOUCH_TOUCH: if (!found) { Touchpoint *tp = new Touchpoint(mtouch_event.x, mtouch_event.y, mtouch_event.contact_id); if(mtouch_event.contact_id<4){ tp->setColor(colors[mtouch_event.contact_id][0],colors[mtouch_event.contact_id][1],colors[mtouch_event.contact_id][2]); } points.push_back(*tp); fprintf(stderr,"neuer touchpoint: %i Orientation: %i \n",mtouch_event.contact_id,tp->startRotation); } else { p->updatePosition(mtouch_event.x, mtouch_event.y); } break; case SCREEN_EVENT_MTOUCH_MOVE: if (found) { p->updatePosition(mtouch_event.x, mtouch_event.y); } else { fprintf(stderr, "ERROR: TOUCH POINT NOT FOUND\n"); } break; case SCREEN_EVENT_MTOUCH_RELEASE: if (found) { p->setInvisible(); } else { fprintf(stderr, "ERROR: TOUCH POINT NOT FOUND\n"); } break; } }