From c87d2b8c13f900d9f0589057de867d171f0176ab Mon Sep 17 00:00:00 2001 From: Nathan Date: Fri, 6 Oct 2017 18:44:08 -0500 Subject: [PATCH] near label adjustments Former-commit-id: 25bbea7e72dc4a10d4e21b8930ba043410208f49 Former-commit-id: e830a7f9cea6d804dca76b84c2fd8491b7dedccd --- sdl1090/defs.h | 2 +- sdl1090/init.c | 3 +-- sdl1090/status.c | 19 ++++++++++++------- sdl1090/view1090.REMOVED.git-id | 2 +- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/sdl1090/defs.h b/sdl1090/defs.h index 19b2070..9474c32 100644 --- a/sdl1090/defs.h +++ b/sdl1090/defs.h @@ -13,7 +13,7 @@ #define SCREEN_WIDTH 320 #define SCREEN_HEIGHT 480 -#define UPSCALE 3 +#define UPSCALE 1 #define LOGMAXDIST 1000.0 #define MAXDIST 50.0 diff --git a/sdl1090/init.c b/sdl1090/init.c index 07c7df0..3644276 100644 --- a/sdl1090/init.c +++ b/sdl1090/init.c @@ -12,6 +12,7 @@ void mouseSetup() { pinMode(27, INPUT); pullUpDnControl (27, PUD_UP); + SDL_ShowCursor(SDL_DISABLE); #endif } @@ -44,8 +45,6 @@ void init(char *title) exit(1); } - SDL_ShowCursor(SDL_DISABLE); - #ifdef RPI const SDL_VideoInfo* vInfo = SDL_GetVideoInfo(); diff --git a/sdl1090/status.c b/sdl1090/status.c index 4080a38..83da594 100644 --- a/sdl1090/status.c +++ b/sdl1090/status.c @@ -68,8 +68,11 @@ void drawStatusBox(int *left, int *top, char *label, char *message, SDL_Color co int labelWidth = ((strlen(label) > 0 ) ? 1.5 : 0) * game.labelFontHeight; int messageWidth = (strlen(message) + ((strlen(message) > 0 ) ? 1 : 0)) * game.messageFontWidth; + //newline if no message or label if(strlen(label) == 0 && strlen(message) == 0 ) { - boxRGBA(game.screen, *left, *top, Modes.screen_width - PAD, *top + game.messageFontHeight, darkGrey.r, darkGrey.g, darkGrey.b, SDL_ALPHA_OPAQUE); + boxRGBA(game.screen, *left, *top, Modes.screen_width - PAD, *top + game.messageFontHeight,0, 0, 0, 0); + *left = PAD; + *top = *top - game.messageFontHeight - PAD; return; } @@ -133,6 +136,11 @@ void drawStatus() { drawStatusBox(&left, &top, "||||", "MENU", grey); if(Status.closeCall != NULL) { + // if no flight id, "near" box goes on first line + if(!strlen(Status.closeCall->flight)) { + drawStatusBox(&left, &top, "near", "", red); + } + char strSpeed[8] = " "; snprintf(strSpeed, 8, "%.0fkm/h", Status.closeCall->speed * 1.852); drawStatusBox(&left, &top, "vel", strSpeed, white); @@ -141,14 +149,11 @@ void drawStatus() { snprintf(strAlt, 8, "%.0fm", Status.closeCall->altitude / 3.2828); drawStatusBox(&left, &top, "alt", strAlt, white); + drawStatusBox(&left, &top, "", "", black); //this is effectively a newline + if(strlen(Status.closeCall->flight)) { + drawStatusBox(&left, &top, "near", "", red); drawStatusBox(&left, &top, "id", Status.closeCall->flight, white); } - - drawStatusBox(&left, &top, "near", "", red); } - - - - //drawStatusBox(&left, &top, "", "", black); } diff --git a/sdl1090/view1090.REMOVED.git-id b/sdl1090/view1090.REMOVED.git-id index e733561..a366532 100644 --- a/sdl1090/view1090.REMOVED.git-id +++ b/sdl1090/view1090.REMOVED.git-id @@ -1 +1 @@ -b5241264afa7daa6932550d55fbf3c936b530c90 \ No newline at end of file +d5ebf86bb1a0e40d3ca3749d31c89c02dbc12fc6 \ No newline at end of file