near label adjustments

Former-commit-id: a4ac7940f9390ff258d03ad464dbe7ca9aa776fb
Former-commit-id: b206ac5d9c787b9b86a761ec7db6347fd54bbfcb
This commit is contained in:
Nathan 2017-10-06 18:44:08 -05:00
parent 97bbe94df5
commit 3f96f8c9e8
4 changed files with 15 additions and 11 deletions

View file

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

View file

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

View file

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

View file

@ -1 +1 @@
b5241264afa7daa6932550d55fbf3c936b530c90
d5ebf86bb1a0e40d3ca3749d31c89c02dbc12fc6