started adding tap (debug only for now)

Former-commit-id: aef9365c434e1ba1d9146f7cf8c37706b80a96b2
Former-commit-id: 3f0f4f4235ba99d564d88f2bed86757b79b6afac
This commit is contained in:
nathan 2020-02-16 21:54:46 -08:00
parent 17ff9f3ef5
commit 0d01589322
13 changed files with 64 additions and 5 deletions

16
draw.c
View file

@ -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);
}
}
//

View file

@ -1 +1 @@
4dc33d9f8be5dcade60c5ce4a92e98d0da98849c
1d914216fcda8f2b793acf12bfbfddfb24809c94

BIN
font.o

Binary file not shown.

BIN
init.o

Binary file not shown.

37
input.c
View file

@ -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;
}
}

View file

@ -1 +1 @@
16d52890261f72e78ba71c37bea36a5c18405767
4014ada04a2708aebb111395550edf352c684f96

BIN
list.o

Binary file not shown.

BIN
monokai.o

Binary file not shown.

Binary file not shown.

View file

@ -1 +1 @@
b1eb5d50ff478da938172f368ef72d8de4100ceb
ec8f0fb7706c5fa30afa98ef72cf1c6277615e5c

View file

@ -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();

View file

@ -1 +1 @@
f2546650b9e09d0840df7238dbb42cac66e1f5e9
4c1cc2ef49ee01e71918440dd30dd506c50f2a13

View file

@ -1 +1 @@
015246b1fb747817b20ce17e660e6fb65096a4ff
c32a44e5918f8a87926408a39f094f258c9f76e6