diff --git a/draw.c b/draw.c index 8b2a369..d0cd543 100644 --- a/draw.c +++ b/draw.c @@ -881,6 +881,7 @@ void drawMap() { pxFromLonLat(&dx, &dy, p->lon, p->lat); screenCoords(&x, &y, dx, dy); + if((int)(now - p->seen) > DISPLAY_ACTIVE) { planeColor = grey; } else { @@ -945,6 +946,21 @@ void drawMap() { } p = p->next; } + + + if(appData.touchx && appData.touchy) { + + int radius = (mstime() - appData.touchDownTime); + int alpha = 255 - (int)(0.5 * (mstime() - appData.touchDownTime)); + if(alpha < 0 ) { + alpha = 0; + appData.touchx = 0; + appData.touchy = 0; + } + + circleRGBA(appData.renderer, appData.touchx, appData.touchy, radius, white.r, white.g, white.b, alpha); + + } } // diff --git a/draw.o.REMOVED.git-id b/draw.o.REMOVED.git-id index b9c3d03..8f54ef4 100644 --- a/draw.o.REMOVED.git-id +++ b/draw.o.REMOVED.git-id @@ -1 +1 @@ -4dc33d9f8be5dcade60c5ce4a92e98d0da98849c \ No newline at end of file +1d914216fcda8f2b793acf12bfbfddfb24809c94 \ No newline at end of file diff --git a/font.o b/font.o index 3cc27a7..9acfc71 100644 Binary files a/font.o and b/font.o differ diff --git a/init.o b/init.o index 129f6da..7d18cc4 100644 Binary files a/init.o and b/init.o differ diff --git a/input.c b/input.c index 8dbcfb7..8ccf87a 100644 --- a/input.c +++ b/input.c @@ -1,6 +1,16 @@ #include "structs.h" #include "view1090.h" +static uint64_t mstime(void) { + struct timeval tv; + uint64_t mst; + + gettimeofday(&tv, NULL); + mst = ((uint64_t)tv.tv_sec)*1000; + mst += tv.tv_usec/1000; + return mst; +} + void getInput() { SDL_Event event; @@ -58,9 +68,36 @@ void getInput() double outLon = dx * (1.0/6371.0) * (180.0f / M_PI) / cos(((appData.centerLat)/2.0f) * M_PI / 180.0f); + //double outLon, outLat; + //latLonFromScreenCoords(&outLat, &outLon, event.tfinger.dx, event.tfinger.dy); appData.centerLon += outLon; appData.centerLat += outLat; + + break; + + + case SDL_FINGERDOWN: + appData.touchDownTime = mstime(); + break; + + case SDL_FINGERUP: + if(mstime() - appData.touchDownTime < 30) { + //latLonFromScreenCoords(&(appData.touchLat), &(appData.touchLon), event.tfinger.x, event.tfinger.y); + // double scale_factor = (appData.screen_width > appData.screen_height) ? appData.screen_width : appData.screen_height; + + // double dx = -1.0 * (0.75*(double)appData.screen_width / (double)appData.screen_height) * appData.screen_width * event.tfinger.x * appData.maxDist / (0.95 * scale_factor * 0.5); + // double dy = 1.0 * appData.screen_height * event.tfinger.y * appData.maxDist / (0.95 * scale_factor * 0.5); + + // appData.touchLat = dy * (1.0/6371.0) * (180.0f / M_PI); + + // appData.touchLon = dx * (1.0/6371.0) * (180.0f / M_PI) / cos(((appData.centerLat)/2.0f) * M_PI / 180.0f); + appData.touchx = appData.screen_width * event.tfinger.x; + appData.touchy = appData.screen_height * event.tfinger.y; + } else { + appData.touchx = 0; + appData.touchy = 0; + } break; } } diff --git a/input.o.REMOVED.git-id b/input.o.REMOVED.git-id index 9dd6b32..360c152 100644 --- a/input.o.REMOVED.git-id +++ b/input.o.REMOVED.git-id @@ -1 +1 @@ -16d52890261f72e78ba71c37bea36a5c18405767 \ No newline at end of file +4014ada04a2708aebb111395550edf352c684f96 \ No newline at end of file diff --git a/list.o b/list.o index 93dc507..dfda3c3 100644 Binary files a/list.o and b/list.o differ diff --git a/monokai.o b/monokai.o index 5981be1..f4fa057 100644 Binary files a/monokai.o and b/monokai.o differ diff --git a/planeObj.o b/planeObj.o index 07195dc..55fc516 100644 Binary files a/planeObj.o and b/planeObj.o differ diff --git a/status.o.REMOVED.git-id b/status.o.REMOVED.git-id index 4454ba8..b903e78 100644 --- a/status.o.REMOVED.git-id +++ b/status.o.REMOVED.git-id @@ -1 +1 @@ -b1eb5d50ff478da938172f368ef72d8de4100ceb \ No newline at end of file +ec8f0fb7706c5fa30afa98ef72cf1c6277615e5c \ No newline at end of file diff --git a/structs.h b/structs.h index 5e64226..6ae020c 100644 --- a/structs.h +++ b/structs.h @@ -39,6 +39,10 @@ typedef struct AppData double centerLon; double centerLat; + uint64_t touchDownTime; + int touchx; + int touchy; + uint64_t lastFrameTime; } AppData; @@ -115,6 +119,8 @@ void drawList(int top); //draw.c void draw(); +void latLonFromScreenCoords(double *lat, double *lon, int x, int y); + //status.c void updateStatus(); diff --git a/view1090.REMOVED.git-id b/view1090.REMOVED.git-id index cc7ce57..267e656 100644 --- a/view1090.REMOVED.git-id +++ b/view1090.REMOVED.git-id @@ -1 +1 @@ -f2546650b9e09d0840df7238dbb42cac66e1f5e9 \ No newline at end of file +4c1cc2ef49ee01e71918440dd30dd506c50f2a13 \ No newline at end of file diff --git a/view1090.o.REMOVED.git-id b/view1090.o.REMOVED.git-id index c6417f6..55d52d1 100644 --- a/view1090.o.REMOVED.git-id +++ b/view1090.o.REMOVED.git-id @@ -1 +1 @@ -015246b1fb747817b20ce17e660e6fb65096a4ff \ No newline at end of file +c32a44e5918f8a87926408a39f094f258c9f76e6 \ No newline at end of file