| 35 | } |
| 36 | |
| 37 | void loop() { |
| 38 | SDL_Event event; |
| 39 | while (SDL_PollEvent(&event)) { |
| 40 | switch(event.type) { |
| 41 | case SDL_FINGERMOTION: |
| 42 | case SDL_FINGERDOWN: |
| 43 | case SDL_FINGERUP: { |
| 44 | SDL_TouchFingerEvent *t = (SDL_TouchFingerEvent*)&event; |
| 45 | printf("type: %s, timestamp: %u, touchId: %llu, fingerId: %llu, x: %f, y: %f, dx: %f, dy: %f, pressure: %f\n", |
| 46 | TouchFingerTypeToString(event.type), t->timestamp, t->touchId, t->fingerId, t->x, t->y, t->dx, t->dy, t->pressure); |
| 47 | |
| 48 | if (t->timestamp != 0 && t->x >= 0.f && t->x <= 1.f && t->y >= 0.f && t->y <= 1.f && t->pressure >= 0.f && t->pressure <= 1.f) { |
| 49 | if (event.type == SDL_FINGERDOWN) { got_down = 1; progress(); } |
| 50 | if (event.type == SDL_FINGERMOTION) { got_move = 1; progress(); } |
| 51 | if (event.type == SDL_FINGERDOWN) { got_up = 1; progress(); } |
| 52 | } |
| 53 | break; |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | int main() { |
| 60 | SDL_Init(SDL_INIT_VIDEO); |
nothing calls this directly
no test coverage detected