diff --git a/sdl1090/defs.h b/sdl1090/defs.h index 21dd7f3..57bca6e 100644 --- a/sdl1090/defs.h +++ b/sdl1090/defs.h @@ -18,4 +18,6 @@ #define AA 0 -#define MAGMA 0 \ No newline at end of file +#define MAGMA 0 + +#define ROUND_RADIUS 3 \ No newline at end of file diff --git a/sdl1090/draw.c b/sdl1090/draw.c index 94112f7..0981d2c 100644 --- a/sdl1090/draw.c +++ b/sdl1090/draw.c @@ -26,11 +26,10 @@ void draw() { SDL_RenderClear(game.renderer); - if (Modes.map) { - drawMap(); - drawStatus(); - } else { - drawList(10,0); + drawMap(); + drawStatus(); + if(!Modes.map) { + drawList(0); } SDL_RenderPresent(game.renderer); diff --git a/sdl1090/dump1090.h b/sdl1090/dump1090.h index 6058e7d..5fd9380 100644 --- a/sdl1090/dump1090.h +++ b/sdl1090/dump1090.h @@ -230,7 +230,7 @@ struct aircraft { uint64_t even_cprtime; double lat, lon; // Coordinated obtained from CPR encoded data double dx, dy; // distance in km - double oldDx[MODES_INTERACTIVE_TRAIL_LENGTH], oldDy[MODES_INTERACTIVE_TRAIL_LENGTH]; // position history + double oldDx[MODES_INTERACTIVE_TRAIL_LENGTH], oldDy[MODES_INTERACTIVE_TRAIL_LENGTH], oldHeading[MODES_INTERACTIVE_TRAIL_LENGTH]; // position history time_t oldSeen[MODES_INTERACTIVE_TRAIL_LENGTH];// position time uint8_t oldIdx; // index for ring buffer uint64_t created; diff --git a/sdl1090/font/PxPlus/PxPlus_AmstradPC1512-2y.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_AmstradPC1512-2y.ttf.REMOVED.git-id new file mode 100644 index 0000000..f455312 --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_AmstradPC1512-2y.ttf.REMOVED.git-id @@ -0,0 +1 @@ +091001c845fa041bb58677bdb97edc546a43b72d \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_AmstradPC1512.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_AmstradPC1512.ttf.REMOVED.git-id new file mode 100644 index 0000000..ec43a52 --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_AmstradPC1512.ttf.REMOVED.git-id @@ -0,0 +1 @@ +248a001641f39a4ad8b75387b889698120fd4983 \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_IBM_BIOS-2x.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_IBM_BIOS-2x.ttf.REMOVED.git-id new file mode 100644 index 0000000..0177c5d --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_IBM_BIOS-2x.ttf.REMOVED.git-id @@ -0,0 +1 @@ +130bb4a9cecd7210769427502b3ee33cdb097341 \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_IBM_BIOS-2y.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_IBM_BIOS-2y.ttf.REMOVED.git-id new file mode 100644 index 0000000..b5a67e7 --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_IBM_BIOS-2y.ttf.REMOVED.git-id @@ -0,0 +1 @@ +2a1ec89b5722143dfbdee504bbddab3a48b7bdd6 \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_IBM_BIOS.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_IBM_BIOS.ttf.REMOVED.git-id new file mode 100644 index 0000000..7ff8681 --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_IBM_BIOS.ttf.REMOVED.git-id @@ -0,0 +1 @@ +672aac709f31f3596fe66420cbc409122c8cb706 \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_IBM_CGA-2y.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_IBM_CGA-2y.ttf.REMOVED.git-id new file mode 100644 index 0000000..357dec5 --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_IBM_CGA-2y.ttf.REMOVED.git-id @@ -0,0 +1 @@ +f20e8486e0becccceddade23c1f89d5336aebc49 \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_IBM_CGA.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_IBM_CGA.ttf.REMOVED.git-id new file mode 100644 index 0000000..d4bbba6 --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_IBM_CGA.ttf.REMOVED.git-id @@ -0,0 +1 @@ +11cbae78cf937af2f5c0236b8f86cad443162a2f \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_IBM_CGAthin-2y.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_IBM_CGAthin-2y.ttf.REMOVED.git-id new file mode 100644 index 0000000..5371b0c --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_IBM_CGAthin-2y.ttf.REMOVED.git-id @@ -0,0 +1 @@ +e8aa21e61df3e92fb290abc35215afdfe9a6db0a \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_IBM_CGAthin.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_IBM_CGAthin.ttf.REMOVED.git-id new file mode 100644 index 0000000..ea69cca --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_IBM_CGAthin.ttf.REMOVED.git-id @@ -0,0 +1 @@ +bca6a642079482aab1d8d68488c6302c9e0e284d \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_IBM_EGA8-2x.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_IBM_EGA8-2x.ttf.REMOVED.git-id new file mode 100644 index 0000000..dde90b5 --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_IBM_EGA8-2x.ttf.REMOVED.git-id @@ -0,0 +1 @@ +5aeb931af933ee4dd2557a465ecadf908dc53978 \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_IBM_EGA8.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_IBM_EGA8.ttf.REMOVED.git-id new file mode 100644 index 0000000..8439bf8 --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_IBM_EGA8.ttf.REMOVED.git-id @@ -0,0 +1 @@ +22983e3d94e5c6e9c3f85f2bb6aff805b31657d0 \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_IBM_EGA9-2x.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_IBM_EGA9-2x.ttf.REMOVED.git-id new file mode 100644 index 0000000..15c8736 --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_IBM_EGA9-2x.ttf.REMOVED.git-id @@ -0,0 +1 @@ +66c93d8a95903ec73a80ea4f49811d23525ed967 \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_IBM_EGA9.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_IBM_EGA9.ttf.REMOVED.git-id new file mode 100644 index 0000000..dad2805 --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_IBM_EGA9.ttf.REMOVED.git-id @@ -0,0 +1 @@ +d07ca5d41b3a257274f42c5fe0b402a672ea612a \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_IBM_MDA.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_IBM_MDA.ttf.REMOVED.git-id new file mode 100644 index 0000000..c85933c --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_IBM_MDA.ttf.REMOVED.git-id @@ -0,0 +1 @@ +db3b7b20ab68a2010a29158ad5a86a1fff1f86e5 \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_IBM_VGA8-2x.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_IBM_VGA8-2x.ttf.REMOVED.git-id new file mode 100644 index 0000000..5d81c78 --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_IBM_VGA8-2x.ttf.REMOVED.git-id @@ -0,0 +1 @@ +6963c72346edf4b03a76271242ca933ac9afb750 \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_IBM_VGA8.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_IBM_VGA8.ttf.REMOVED.git-id new file mode 100644 index 0000000..336ad79 --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_IBM_VGA8.ttf.REMOVED.git-id @@ -0,0 +1 @@ +0368d2bbae0b02dfeeb66950db2f79109714756e \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_IBM_VGA9-2x.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_IBM_VGA9-2x.ttf.REMOVED.git-id new file mode 100644 index 0000000..e2201ea --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_IBM_VGA9-2x.ttf.REMOVED.git-id @@ -0,0 +1 @@ +f159709859ade068ba25e93720a5c8abc2fd20ce \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_IBM_VGA9.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_IBM_VGA9.ttf.REMOVED.git-id new file mode 100644 index 0000000..97b020d --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_IBM_VGA9.ttf.REMOVED.git-id @@ -0,0 +1 @@ +53c606887962f52031d77dd4fe9c1ce85ce0783e \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_TandyNew_225-2y.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_TandyNew_225-2y.ttf.REMOVED.git-id new file mode 100644 index 0000000..d0e8092 --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_TandyNew_225-2y.ttf.REMOVED.git-id @@ -0,0 +1 @@ +e52ba0d0e32c0a8a9de183dc11352f59c754c764 \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_TandyNew_225.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_TandyNew_225.ttf.REMOVED.git-id new file mode 100644 index 0000000..5a95e3a --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_TandyNew_225.ttf.REMOVED.git-id @@ -0,0 +1 @@ +f279c6703790767cc5efae5941913527c039cb0b \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_TandyNew_TV-2y.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_TandyNew_TV-2y.ttf.REMOVED.git-id new file mode 100644 index 0000000..b42dc2f --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_TandyNew_TV-2y.ttf.REMOVED.git-id @@ -0,0 +1 @@ +653a1008f0ee073bafcd84e21bddd930e03579b1 \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_TandyNew_TV.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_TandyNew_TV.ttf.REMOVED.git-id new file mode 100644 index 0000000..11015b7 --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_TandyNew_TV.ttf.REMOVED.git-id @@ -0,0 +1 @@ +d206e1de86a19ab735257abba83e25bd1d296ebb \ No newline at end of file diff --git a/sdl1090/font/PxPlus/PxPlus_VGA_SquarePx.ttf.REMOVED.git-id b/sdl1090/font/PxPlus/PxPlus_VGA_SquarePx.ttf.REMOVED.git-id new file mode 100644 index 0000000..8d9102d --- /dev/null +++ b/sdl1090/font/PxPlus/PxPlus_VGA_SquarePx.ttf.REMOVED.git-id @@ -0,0 +1 @@ +9fe3e4aecd84c498563c3af03fe7050924915f60 \ No newline at end of file diff --git a/sdl1090/init.c b/sdl1090/init.c index dbb7a1b..010fc3f 100644 --- a/sdl1090/init.c +++ b/sdl1090/init.c @@ -56,7 +56,7 @@ void init(char *title) { game.mapFont = loadFont("font/TerminusTTF-4.46.0.ttf", 12 * Modes.screen_uiscale); game.mapBoldFont = loadFont("font/TerminusTTF-Bold-4.46.0.ttf", 12 * Modes.screen_uiscale); - game.listFont = loadFont("font/TerminusTTF-Bold-4.46.0.ttf", 18 * Modes.screen_uiscale); + game.listFont = loadFont("font/TerminusTTF-4.46.0.ttf", 12 * Modes.screen_uiscale); game.messageFont = loadFont("font/TerminusTTF-Bold-4.46.0.ttf", 12 * Modes.screen_uiscale); game.labelFont = loadFont("font/TerminusTTF-Bold-4.46.0.ttf", 12 * Modes.screen_uiscale); diff --git a/sdl1090/input.c b/sdl1090/input.c index 2ea16db..2aeea59 100644 --- a/sdl1090/input.c +++ b/sdl1090/input.c @@ -67,11 +67,11 @@ void getInput() // // need to make lonlat to screen conversion class - this is just the inverse of the stuff in draw.c, without offsets // - + double scale_factor = (Modes.screen_width > Modes.screen_height) ? Modes.screen_width : Modes.screen_height; double dx = -1.0 * (0.75*(double)Modes.screen_width / (double)Modes.screen_height) * Modes.screen_width * event.tfinger.dx * Modes.maxDist / (0.95 * scale_factor * 0.5); - double dy = -1.0 * Modes.screen_height * event.tfinger.dy * Modes.maxDist / (0.95 * scale_factor * 0.5); + double dy = 1.0 * Modes.screen_height * event.tfinger.dy * Modes.maxDist / (0.95 * scale_factor * 0.5); double outLat = dy * (1.0/6371.0) * (180.0f / M_PI); diff --git a/sdl1090/interactive.c b/sdl1090/interactive.c index d292be8..45b1861 100644 --- a/sdl1090/interactive.c +++ b/sdl1090/interactive.c @@ -144,6 +144,7 @@ struct aircraft *interactiveCreateAircraft(struct modesMessage *mm) { a->oldIdx = 0; memset(a->oldDx, 0, sizeof(a->oldDx)); memset(a->oldDy, 0, sizeof(a->oldDy)); + memset(a->oldHeading, 0, sizeof(a->oldHeading)); memset(a->signalLevel, mm->signalLevel, 8); // First time, initialise everything // to the first signal strength @@ -411,6 +412,8 @@ struct aircraft *interactiveReceiveData(struct modesMessage *mm) { a->oldDx[a->oldIdx] = a->dx; a->oldDy[a->oldIdx] = a->dy; + a->oldHeading[a->oldIdx] = a->track; + a->oldSeen[a->oldIdx] = a->seen; } } diff --git a/sdl1090/list.c b/sdl1090/list.c index 9a8082a..bddd11b 100644 --- a/sdl1090/list.c +++ b/sdl1090/list.c @@ -4,7 +4,7 @@ #include "monokai.h" #include "SDL2/SDL2_gfxPrimitives.h" -void drawList(int rows, int top) { +void drawList(int top) { struct aircraft *a = Modes.aircrafts; time_t now = time(NULL); int count = 0; @@ -13,7 +13,9 @@ void drawList(int rows, int top) { progress = spinner[time(NULL)%4]; - drawStringBG(" Flight Alt(m) km/h D(km) H S ", 0, top, game.listFont, black, white); + drawStringBG(" Flight Alt(m) km/h D(km) H S ", 0, top, game.mapBoldFont, black, (SDL_Color){255,255,255,64}); + + top = top + game.mapFontHeight; // int xstride = 10; // for(int i = 0; i < 320 / xstride; i++) { @@ -26,7 +28,12 @@ void drawList(int rows, int top) { // } int numNoDir = 0; - while(a && (count < rows)) { + while(a) { + + if(top > Modes.screen_height) { + return; + } + if ((now - a->seen) < Modes.interactive_display_ttl) { int msgs = a->messages; @@ -123,25 +130,18 @@ void drawList(int rows, int top) { if ((now - a->seen) > 30 ) { - drawString(a->flight, 0, top + (count + 1) * 20, game.listFont, (SDL_Color){96,96,96,255}); + drawString(a->flight, 0, top, game.listFont, (SDL_Color){96,96,96,255}); - // printf("\x1B[1;30m%-8s%5s %4s %5s %c%c %d", - // a->flight, - // strFl, - // strGs, - // strD, - // cLat, cLon, - // (int)((float)signalAverage/25.0f)); } else { - drawString(a->flight, 10, top + (count + 1) * 20, game.listFont, pink); + drawString(a->flight, 10, top, game.listFont, pink); - drawString(strFl, 90, top + (count + 1) * 20, game.listFont, orange); + drawString(strFl, 90, top, game.listFont, orange); - drawString(strGs, 160, top + (count + 1) * 20, game.listFont, green); + drawString(strGs, 160, top, game.listFont, green); - drawString(strD, 210, top + (count + 1) * 20, game.listFont, blue); + drawString(strD, 210, top, game.listFont, blue); - drawString(strDir, 270, top + (count + 1) * 20, game.listFont, yellow); + drawString(strDir, 270, top, game.listFont, yellow); // drawString(strS, 290, (count + 1) * 20, game.listFont, (SDL_Color){255,9,96,255}); @@ -153,6 +153,7 @@ void drawList(int rows, int top) { // cLat, cLon, // (int)((float)signalAverage/25.0f)); } + top = top + game.mapFontHeight; count++; } else { numNoDir++; diff --git a/sdl1090/maps.c b/sdl1090/maps.c index 7e4bf67..87b1247 100644 --- a/sdl1090/maps.c +++ b/sdl1090/maps.c @@ -78,7 +78,7 @@ void pxFromLonLat(double *dx, double *dy, double lon, double lat) { void screenCoords(int *outX, int *outY, double dx, double dy) { *outX = (Modes.screen_width>>1) + ((dx>0) ? 1 : -1) * screenDist(dx); - *outY = (Modes.screen_height * CENTEROFFSET) + ((dy>0) ? 1 : -1) * screenDist(dy); + *outY = (Modes.screen_height * CENTEROFFSET) + ((dy>0) ? -1 : 1) * screenDist(dy); } int outOfBounds(int x, int y) { @@ -156,7 +156,7 @@ void drawPlaneHeading(int x, int y, double heading, SDL_Color planeColor) double vec[3]; vec[0] = sin(heading * M_PI / 180); - vec[1] = cos(heading * M_PI / 180); + vec[1] = -cos(heading * M_PI / 180); vec[2] = 0; double up[] = {0,0,1}; @@ -221,7 +221,7 @@ void drawPlane(int x, int y, SDL_Color planeColor) } -void drawTrail(double *oldDx, double *oldDy, time_t * oldSeen, int idx) { +void drawTrail(double *oldDx, double *oldDy, double *oldHeading, time_t * oldSeen, int idx) { int currentIdx, prevIdx; @@ -273,8 +273,42 @@ void drawTrail(double *oldDx, double *oldDy, time_t * oldSeen, int idx) { aalineRGBA(game.renderer, prevX, prevY, currentX, currentY,colorVal, colorVal, colorVal, SDL_ALPHA_OPAQUE); } else { //thickLineRGBA(game.renderer, prevX, prevY, currentX, currentY, 2, colorVal, colorVal, colorVal, SDL_ALPHA_OPAQUE); - thickLineRGBA(game.renderer, prevX, prevY, currentX, currentY, 2 * Modes.screen_uiscale, colorVal, colorVal, colorVal, SDL_ALPHA_OPAQUE); - } + thickLineRGBA(game.renderer, prevX, prevY, currentX, currentY, 4 * Modes.screen_uiscale, colorVal, colorVal, colorVal, 127); + } + + //tick marks + + double vec[3]; + vec[0] = sin(oldHeading[currentIdx] * M_PI / 180); + vec[1] = -cos(oldHeading[currentIdx] * M_PI / 180); + vec[2] = 0; + + double up[] = {0,0,1}; + + double out[3]; + + CROSSVP(out,vec,up); + + + int x1, y1, x2, y2; + + int cross_size = 8 * Modes.screen_uiscale; + + //forward cross + x1 = currentX + round(-cross_size*vec[0]); + y1 = currentY + round(-cross_size*vec[1]); + x2 = currentX + round(cross_size*vec[0]); + y2 = currentY + round(cross_size*vec[1]); + + lineRGBA(game.renderer,x1,y1,x2,y2,colorVal,colorVal,colorVal,127); + + //side cross + x1 = currentX + round(-cross_size*out[0]); + y1 = currentY + round(-cross_size*out[1]); + x2 = currentX + round(cross_size*out[0]); + y2 = currentY + round(cross_size*out[1]); + + lineRGBA(game.renderer,x1,y1,x2,y2,colorVal,colorVal,colorVal,127); } } @@ -284,8 +318,8 @@ void drawGrid() int p10km = screenDist(10.0); int p100km = screenDist(100.0); - hlineRGBA (game.renderer, (Modes.screen_width>>1) - p100km, (Modes.screen_width>>1) + p100km, Modes.screen_height * CENTEROFFSET, grey.r, grey.g, grey.b, SDL_ALPHA_OPAQUE); - vlineRGBA (game.renderer, Modes.screen_width>>1, (Modes.screen_height * CENTEROFFSET) - p100km, (Modes.screen_height * CENTEROFFSET) + p100km, grey.r, grey.g, grey.b, SDL_ALPHA_OPAQUE); + //hlineRGBA (game.renderer, (Modes.screen_width>>1) - p100km, (Modes.screen_width>>1) + p100km, Modes.screen_height * CENTEROFFSET, grey.r, grey.g, grey.b, SDL_ALPHA_OPAQUE); + //vlineRGBA (game.renderer, Modes.screen_width>>1, (Modes.screen_height * CENTEROFFSET) - p100km, (Modes.screen_height * CENTEROFFSET) + p100km, grey.r, grey.g, grey.b, SDL_ALPHA_OPAQUE); if(AA) { aacircleRGBA (game.renderer, Modes.screen_width>>1, Modes.screen_height>>1, p1km, pink.r, pink.g, pink.b, 255); @@ -368,7 +402,7 @@ void drawMap(void) { drawGeography(); - //drawGrid(); + drawGrid(); while(a) { if ((now - a->seen) < Modes.interactive_display_ttl) { @@ -378,7 +412,7 @@ void drawMap(void) { unsigned int signalAverage = (pSig[0] + pSig[1] + pSig[2] + pSig[3] + pSig[4] + pSig[5] + pSig[6] + pSig[7] + 3) >> 3; - drawTrail(a->oldDx, a->oldDy, a->oldSeen, a->oldIdx); + drawTrail(a->oldDx, a->oldDy, a->oldHeading, a->oldSeen, a->oldIdx); int colorIdx; if((int)(now - a->seen) > MODES_INTERACTIVE_DISPLAY_ACTIVE) { diff --git a/sdl1090/status.c b/sdl1090/status.c index a67f8c5..ca7960b 100644 --- a/sdl1090/status.c +++ b/sdl1090/status.c @@ -87,17 +87,17 @@ void drawStatusBox(int *left, int *top, char *label, char *message, SDL_Color co // filled black background if(messageWidth) { - boxRGBA(game.renderer, *left, *top, *left + labelWidth + messageWidth, *top + game.messageFontHeight, black.r, black.g, black.b, SDL_ALPHA_OPAQUE); + roundedBoxRGBA(game.renderer, *left, *top, *left + labelWidth + messageWidth, *top + game.messageFontHeight, ROUND_RADIUS, black.r, black.g, black.b, SDL_ALPHA_OPAQUE); } // filled label box if(labelWidth) { - boxRGBA(game.renderer, *left, *top, *left + labelWidth, *top + game.messageFontHeight, color.r, color.g, color.b, SDL_ALPHA_OPAQUE); + roundedBoxRGBA(game.renderer, *left, *top, *left + labelWidth, *top + game.messageFontHeight, ROUND_RADIUS,color.r, color.g, color.b, SDL_ALPHA_OPAQUE); } // outline message box if(messageWidth) { - rectangleRGBA(game.renderer, *left, *top, *left + labelWidth + messageWidth, *top + game.messageFontHeight, color.r, color.g, color.b, SDL_ALPHA_OPAQUE); + roundedRectangleRGBA(game.renderer, *left, *top, *left + labelWidth + messageWidth, *top + game.messageFontHeight, ROUND_RADIUS,color.r, color.g, color.b, SDL_ALPHA_OPAQUE); } // label @@ -112,6 +112,39 @@ void drawStatusBox(int *left, int *top, char *label, char *message, SDL_Color co } + +void drawButtonBox(int *left, int *top, char *label, SDL_Color color) { + int labelWidth = (strlen(label) + ((strlen(label) > 0 ) ? 1 : 0)) * game.labelFontWidth; + + //newline if no message or label + if(strlen(label) == 0) { + boxRGBA(game.renderer, *left, *top, Modes.screen_width - PAD, *top + game.messageFontHeight,0, 0, 0, 0); + *left = PAD; + *top = *top - game.messageFontHeight - PAD; + return; + } + + if(*left + labelWidth + PAD > Modes.screen_width) { + *left = PAD; + *top = *top - game.messageFontHeight - PAD; + } + + // outline message box + if(labelWidth) { + + roundedRectangleRGBA(game.renderer, *left, *top , *left + labelWidth - 1, *top + game.messageFontHeight - 1, ROUND_RADIUS, 255, 255, 255, SDL_ALPHA_OPAQUE); + roundedRectangleRGBA(game.renderer, *left + 1, *top + 1, *left + labelWidth , *top + game.messageFontHeight, ROUND_RADIUS, 20, 20, 20, SDL_ALPHA_OPAQUE); + roundedBoxRGBA(game.renderer, *left + 1, *top + 1, *left + labelWidth - 1, *top + game.messageFontHeight - 1, ROUND_RADIUS, color.r, color.g, color.b, SDL_ALPHA_OPAQUE); + + } + + drawString(label, *left + game.labelFontWidth/2, *top, game.labelFont, black); + + *left = *left + labelWidth + PAD; +} + + + void drawBattery(int *left, int *top, double level) { int lineWidth = 1; @@ -135,8 +168,8 @@ void drawBattery(int *left, int *top, double level) { void drawStatus() { - int left = PAD; - int top = Modes.screen_height - game.messageFontHeight - PAD; + int left = PAD + 2 * game.messageFontHeight ; + int top = Modes.screen_height - 2 * game.messageFontHeight - PAD; char strLoc[20] = " "; snprintf(strLoc, 20, "%3.3fN %3.3f%c", Modes.fUserLat, fabs(Modes.fUserLon),(Modes.fUserLon > 0) ? 'E' : 'W'); @@ -162,12 +195,12 @@ void drawStatus() { // drawStatusBox(&left, &top, "||||", "MENU", grey); - if(Status.closeCall != NULL) { - drawStatusBox(&left, &top, "", "", black); //this is effectively a newline - if(strlen(Status.closeCall->flight)) { - drawStatusBox(&left, &top, "near", Status.closeCall->flight, white); - } else { - drawStatusBox(&left, &top, "near", "", white); - } - } + // if(Status.closeCall != NULL) { + // drawStatusBox(&left, &top, "", "", black); //this is effectively a newline + // if(strlen(Status.closeCall->flight)) { + // drawStatusBox(&left, &top, "near", Status.closeCall->flight, white); + // } else { + // drawStatusBox(&left, &top, "near", "", white); + // } + // } } diff --git a/sdl1090/structs.h b/sdl1090/structs.h index 6ecb27a..a6e503e 100644 --- a/sdl1090/structs.h +++ b/sdl1090/structs.h @@ -46,7 +46,7 @@ void getInput(void); void initMaps(); //list.c -void drawList(int rows, int top); +void drawList(int top); //draw.c void draw(); diff --git a/sdl1090/view1090.REMOVED.git-id b/sdl1090/view1090.REMOVED.git-id index 41ef2ad..c419972 100644 --- a/sdl1090/view1090.REMOVED.git-id +++ b/sdl1090/view1090.REMOVED.git-id @@ -1 +1 @@ -2056de76ba9dff16057865185ffa2eb99617235e \ No newline at end of file +03ce37e44e1175c6d216ace0dc15712026569f3f \ No newline at end of file