adding PC control options like fullscreen, added simple circle anim on first valid lat/long
Former-commit-id: 0cadb77f7d8fd4362beb1bc50caf35d55bf8998f Former-commit-id: 49269e48d57c6839e7cd22c52ffe6e109bf0db82
This commit is contained in:
parent
6bc7a305aa
commit
0ddf73f6c8
|
@ -14,7 +14,7 @@
|
||||||
#define SCREEN_HEIGHT 480
|
#define SCREEN_HEIGHT 480
|
||||||
|
|
||||||
#define UPSCALE 1
|
#define UPSCALE 1
|
||||||
#define SCALE 1
|
#define UISCALE 1
|
||||||
|
|
||||||
#define LOGMAXDIST 1000.0
|
#define LOGMAXDIST 1000.0
|
||||||
#define MAXDIST 50.0
|
#define MAXDIST 50.0
|
||||||
|
|
|
@ -160,7 +160,7 @@
|
||||||
// at least greater than a given level for us to dump the signal.
|
// at least greater than a given level for us to dump the signal.
|
||||||
#define MODES_DEBUG_NOPREAMBLE_LEVEL 25
|
#define MODES_DEBUG_NOPREAMBLE_LEVEL 25
|
||||||
|
|
||||||
#define MODES_INTERACTIVE_REFRESH_TIME 250 // Milliseconds
|
#define MODES_INTERACTIVE_REFRESH_TIME 33 // Milliseconds
|
||||||
#define MODES_INTERACTIVE_ROWS 22 // Rows on screen
|
#define MODES_INTERACTIVE_ROWS 22 // Rows on screen
|
||||||
#define MODES_INTERACTIVE_DELETE_TTL 300 // Delete from the list after 300 seconds
|
#define MODES_INTERACTIVE_DELETE_TTL 300 // Delete from the list after 300 seconds
|
||||||
#define MODES_INTERACTIVE_DISPLAY_TTL 60 // Delete from display after 60 seconds
|
#define MODES_INTERACTIVE_DISPLAY_TTL 60 // Delete from display after 60 seconds
|
||||||
|
@ -233,6 +233,7 @@ struct aircraft {
|
||||||
double oldDx[MODES_INTERACTIVE_TRAIL_LENGTH], oldDy[MODES_INTERACTIVE_TRAIL_LENGTH]; // position history
|
double oldDx[MODES_INTERACTIVE_TRAIL_LENGTH], oldDy[MODES_INTERACTIVE_TRAIL_LENGTH]; // position history
|
||||||
time_t oldSeen[MODES_INTERACTIVE_TRAIL_LENGTH];// position time
|
time_t oldSeen[MODES_INTERACTIVE_TRAIL_LENGTH];// position time
|
||||||
uint8_t oldIdx; // index for ring buffer
|
uint8_t oldIdx; // index for ring buffer
|
||||||
|
uint64_t created;
|
||||||
int bFlags; // Flags related to valid fields in this structure
|
int bFlags; // Flags related to valid fields in this structure
|
||||||
struct aircraft *next; // Next aircraft in our linked list
|
struct aircraft *next; // Next aircraft in our linked list
|
||||||
};
|
};
|
||||||
|
@ -344,9 +345,11 @@ struct { // Internal state
|
||||||
|
|
||||||
//display options
|
//display options
|
||||||
int screen_upscale;
|
int screen_upscale;
|
||||||
|
int screen_uiscale;
|
||||||
int screen_width;
|
int screen_width;
|
||||||
int screen_height;
|
int screen_height;
|
||||||
int screen_depth;
|
int screen_depth;
|
||||||
|
int fullscreen;
|
||||||
|
|
||||||
// User details
|
// User details
|
||||||
double fUserLat; // Users receiver/antenna lat/lon needed for initial surface location
|
double fUserLat; // Users receiver/antenna lat/lon needed for initial surface location
|
||||||
|
|
|
@ -59,12 +59,17 @@ void init(char *title)
|
||||||
Modes.screen_upscale = 1;
|
Modes.screen_upscale = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Uint32 flags = SDL_HWPALETTE|SDL_DOUBLEBUF;
|
||||||
|
|
||||||
|
if(Modes.fullscreen) {
|
||||||
|
flags = flags | SDL_FULLSCREEN;
|
||||||
|
}
|
||||||
|
|
||||||
if(Modes.screen_upscale > 1) {
|
if(Modes.screen_upscale > 1) {
|
||||||
game.bigScreen = SDL_SetVideoMode(Modes.screen_width * Modes.screen_upscale, Modes.screen_height * Modes.screen_upscale, Modes.screen_depth, SDL_HWPALETTE|SDL_DOUBLEBUF);
|
game.bigScreen = SDL_SetVideoMode(Modes.screen_width * Modes.screen_upscale, Modes.screen_height * Modes.screen_upscale, Modes.screen_depth, flags);
|
||||||
game.screen = SDL_CreateRGBSurface(0, Modes.screen_width, Modes.screen_height, Modes.screen_depth, 0, 0, 0, 0);
|
game.screen = SDL_CreateRGBSurface(0, Modes.screen_width, Modes.screen_height, Modes.screen_depth, 0, 0, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
game.screen = SDL_SetVideoMode(Modes.screen_width, Modes.screen_height, Modes.screen_depth, SDL_HWPALETTE|SDL_DOUBLEBUF);
|
game.screen = SDL_SetVideoMode(Modes.screen_width, Modes.screen_height, Modes.screen_depth, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game.screen == NULL)
|
if (game.screen == NULL)
|
||||||
|
@ -78,22 +83,22 @@ void init(char *title)
|
||||||
|
|
||||||
/* Load the font */
|
/* Load the font */
|
||||||
|
|
||||||
game.mapFont = loadFont("font/TerminusTTF-4.46.0.ttf", 12 * SCALE);
|
game.mapFont = loadFont("font/TerminusTTF-4.46.0.ttf", 12 * Modes.screen_uiscale);
|
||||||
game.mapBoldFont = loadFont("font/TerminusTTF-Bold-4.46.0.ttf", 12 * SCALE);
|
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 * SCALE);
|
game.listFont = loadFont("font/TerminusTTF-Bold-4.46.0.ttf", 18 * Modes.screen_uiscale);
|
||||||
|
|
||||||
game.messageFont = loadFont("font/TerminusTTF-Bold-4.46.0.ttf", 34 * SCALE);
|
game.messageFont = loadFont("font/TerminusTTF-Bold-4.46.0.ttf", 34 * Modes.screen_uiscale);
|
||||||
game.labelFont = loadFont("font/TerminusTTF-Bold-4.46.0.ttf", 16 * SCALE);
|
game.labelFont = loadFont("font/TerminusTTF-Bold-4.46.0.ttf", 16 * Modes.screen_uiscale);
|
||||||
|
|
||||||
game.mapFontWidth = 5 * SCALE;
|
game.mapFontWidth = 5 * Modes.screen_uiscale;
|
||||||
game.mapFontHeight = 12 * SCALE;
|
game.mapFontHeight = 12 * Modes.screen_uiscale;
|
||||||
|
|
||||||
game.messageFontWidth = 17 * SCALE;
|
game.messageFontWidth = 17 * Modes.screen_uiscale;
|
||||||
game.messageFontHeight = 34 * SCALE;
|
game.messageFontHeight = 34 * Modes.screen_uiscale;
|
||||||
|
|
||||||
game.labelFontWidth = 5 * SCALE;
|
game.labelFontWidth = 5 * Modes.screen_uiscale;
|
||||||
game.labelFontHeight = 10 * SCALE;
|
game.labelFontHeight = 10 * Modes.screen_uiscale;
|
||||||
|
|
||||||
/* Set the screen title */
|
/* Set the screen title */
|
||||||
|
|
||||||
|
|
|
@ -139,6 +139,8 @@ struct aircraft *interactiveCreateAircraft(struct modesMessage *mm) {
|
||||||
a->addr = mm->addr;
|
a->addr = mm->addr;
|
||||||
a->lat = a->lon = 0.0;
|
a->lat = a->lon = 0.0;
|
||||||
|
|
||||||
|
a->created = 0;
|
||||||
|
|
||||||
a->oldIdx = 0;
|
a->oldIdx = 0;
|
||||||
memset(a->oldDx, 0, sizeof(a->oldDx));
|
memset(a->oldDx, 0, sizeof(a->oldDx));
|
||||||
memset(a->oldDy, 0, sizeof(a->oldDy));
|
memset(a->oldDy, 0, sizeof(a->oldDy));
|
||||||
|
|
File diff suppressed because one or more lines are too long
1
sdl1090/mapdata.c.REMOVED.git-id
Normal file
1
sdl1090/mapdata.c.REMOVED.git-id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
b27351eb14efa48364b7125548c8aa825a31afc6
|
|
@ -8,6 +8,16 @@
|
||||||
|
|
||||||
#define CENTEROFFSET .375
|
#define CENTEROFFSET .375
|
||||||
|
|
||||||
|
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 CROSSVP(double *v, double *u, double *w)
|
void CROSSVP(double *v, double *u, double *w)
|
||||||
{
|
{
|
||||||
v[0] = u[1]*w[2] - u[2]*(w)[1];
|
v[0] = u[1]*w[2] - u[2]*(w)[1];
|
||||||
|
@ -73,10 +83,10 @@ void drawPlaneHeading(int x, int y, double heading, SDL_Color planeColor)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double body = 8.0 * SCALE;
|
double body = 8.0 * Modes.screen_uiscale;
|
||||||
double wing = 6.0 * SCALE;
|
double wing = 6.0 * Modes.screen_uiscale;
|
||||||
double tail = 3.0 * SCALE;
|
double tail = 3.0 * Modes.screen_uiscale;
|
||||||
double bodyWidth = 2.0 * SCALE;
|
double bodyWidth = 2.0 * Modes.screen_uiscale;
|
||||||
|
|
||||||
double vec[3];
|
double vec[3];
|
||||||
vec[0] = sin(heading * M_PI / 180);
|
vec[0] = sin(heading * M_PI / 180);
|
||||||
|
@ -104,7 +114,7 @@ void drawPlaneHeading(int x, int y, double heading, SDL_Color planeColor)
|
||||||
} else {
|
} else {
|
||||||
thickLineRGBA(game.screen,x,y,x2,y2,bodyWidth,planeColor.r,planeColor.g,planeColor.b,SDL_ALPHA_OPAQUE);
|
thickLineRGBA(game.screen,x,y,x2,y2,bodyWidth,planeColor.r,planeColor.g,planeColor.b,SDL_ALPHA_OPAQUE);
|
||||||
filledTrigonRGBA(game.screen, x + round(-wing*.35*out[0]), y + round(-wing*.35*out[1]), x + round(wing*.35*out[0]), y + round(wing*.35*out[1]), x1, y1,planeColor.r,planeColor.g,planeColor.b,SDL_ALPHA_OPAQUE);
|
filledTrigonRGBA(game.screen, x + round(-wing*.35*out[0]), y + round(-wing*.35*out[1]), x + round(wing*.35*out[0]), y + round(wing*.35*out[1]), x1, y1,planeColor.r,planeColor.g,planeColor.b,SDL_ALPHA_OPAQUE);
|
||||||
filledCircleRGBA(game.screen, x2,y2,SCALE,planeColor.r,planeColor.g,planeColor.b,SDL_ALPHA_OPAQUE);
|
filledCircleRGBA(game.screen, x2,y2,Modes.screen_uiscale,planeColor.r,planeColor.g,planeColor.b,SDL_ALPHA_OPAQUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//wing
|
//wing
|
||||||
|
@ -190,7 +200,7 @@ void drawTrail(double *oldDx, double *oldDy, time_t * oldSeen, int idx) {
|
||||||
aalineRGBA(game.screen, prevX, prevY, currentX, currentY,colorVal, colorVal, colorVal, SDL_ALPHA_OPAQUE);
|
aalineRGBA(game.screen, prevX, prevY, currentX, currentY,colorVal, colorVal, colorVal, SDL_ALPHA_OPAQUE);
|
||||||
} else {
|
} else {
|
||||||
//thickLineRGBA(game.screen, prevX, prevY, currentX, currentY, 2, colorVal, colorVal, colorVal, SDL_ALPHA_OPAQUE);
|
//thickLineRGBA(game.screen, prevX, prevY, currentX, currentY, 2, colorVal, colorVal, colorVal, SDL_ALPHA_OPAQUE);
|
||||||
thickLineRGBA(game.screen, prevX, prevY, currentX, currentY, 2 * SCALE, colorVal, colorVal, colorVal, SDL_ALPHA_OPAQUE);
|
thickLineRGBA(game.screen, prevX, prevY, currentX, currentY, 2 * Modes.screen_uiscale, colorVal, colorVal, colorVal, SDL_ALPHA_OPAQUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,7 +253,7 @@ void drawGeography() {
|
||||||
if(AA) {
|
if(AA) {
|
||||||
aalineRGBA(game.screen, x1, y1, x2, y2,purple.r,purple.g,purple.b, (alpha < 0) ? 0 : (uint8_t) alpha);
|
aalineRGBA(game.screen, x1, y1, x2, y2,purple.r,purple.g,purple.b, (alpha < 0) ? 0 : (uint8_t) alpha);
|
||||||
} else {
|
} else {
|
||||||
thickLineRGBA(game.screen, x1, y1, x2, y2, SCALE, purple.r,purple.g,purple.b, (alpha < 0) ? 0 : (uint8_t) alpha);
|
thickLineRGBA(game.screen, x1, y1, x2, y2, Modes.screen_uiscale, purple.r,purple.g,purple.b, (alpha < 0) ? 0 : (uint8_t) alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -277,6 +287,15 @@ void drawMap(void) {
|
||||||
int x, y;
|
int x, y;
|
||||||
screenCoords(&x, &y, a->dx, a->dy);
|
screenCoords(&x, &y, a->dx, a->dy);
|
||||||
|
|
||||||
|
if(a->created == 0) {
|
||||||
|
a->created = mstime();
|
||||||
|
}
|
||||||
|
|
||||||
|
double age_ms = (double)(mstime() - a->created);
|
||||||
|
if(age_ms < 500) {
|
||||||
|
circleRGBA(game.screen, x, y, 500 - age_ms, 255,255, 255, (uint8_t)(255.0 * age_ms / 500.0));
|
||||||
|
}
|
||||||
|
|
||||||
if(MODES_ACFLAGS_HEADING_VALID) {
|
if(MODES_ACFLAGS_HEADING_VALID) {
|
||||||
drawPlaneHeading(x, y,a->track, planeColor);
|
drawPlaneHeading(x, y,a->track, planeColor);
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
6d9c5442d0ddf630e47b4e32c4f9ea2b5ebf4d91
|
28dc4d035492ea5f8627c495e51ea37b58ea01ec
|
|
@ -91,9 +91,11 @@ void view1090InitConfig(void) {
|
||||||
|
|
||||||
// Display options
|
// Display options
|
||||||
Modes.screen_upscale = UPSCALE;
|
Modes.screen_upscale = UPSCALE;
|
||||||
|
Modes.screen_uiscale = UISCALE;
|
||||||
Modes.screen_width = SCREEN_WIDTH;
|
Modes.screen_width = SCREEN_WIDTH;
|
||||||
Modes.screen_height = SCREEN_HEIGHT;
|
Modes.screen_height = SCREEN_HEIGHT;
|
||||||
Modes.screen_depth = 32;
|
Modes.screen_depth = 32;
|
||||||
|
Modes.fullscreen = 0;
|
||||||
|
|
||||||
// Initialize status
|
// Initialize status
|
||||||
Status.msgRate = 0;
|
Status.msgRate = 0;
|
||||||
|
@ -212,7 +214,10 @@ void showHelp(void) {
|
||||||
"\n-----------------------------------------------------------------------------\n"
|
"\n-----------------------------------------------------------------------------\n"
|
||||||
"| SDL DISPLAY OPTIONS |\n"
|
"| SDL DISPLAY OPTIONS |\n"
|
||||||
"-----------------------------------------------------------------------------\n"
|
"-----------------------------------------------------------------------------\n"
|
||||||
"--upscale <factor> Pixel upscaling\n"
|
"--upscale <factor> Buffer upscaling\n"
|
||||||
|
"--uiscale <factor> UI global scaling\n"
|
||||||
|
"--screensize <width> <height>\n"
|
||||||
|
"--fullscreen Start fullscreen\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,8 +302,15 @@ int main(int argc, char **argv) {
|
||||||
Modes.nfix_crc = 0;
|
Modes.nfix_crc = 0;
|
||||||
} else if (!strcmp(argv[j],"--aggressive")) {
|
} else if (!strcmp(argv[j],"--aggressive")) {
|
||||||
Modes.nfix_crc = MODES_MAX_BITERRORS;
|
Modes.nfix_crc = MODES_MAX_BITERRORS;
|
||||||
|
} else if (!strcmp(argv[j],"--fullscreen")) {
|
||||||
|
Modes.fullscreen = 1;
|
||||||
} else if (!strcmp(argv[j],"--upscale") && more) {
|
} else if (!strcmp(argv[j],"--upscale") && more) {
|
||||||
Modes.screen_upscale = atoi(argv[++j]);
|
Modes.screen_upscale = atoi(argv[++j]);
|
||||||
|
} else if (!strcmp(argv[j],"--uiscale") && more) {
|
||||||
|
Modes.screen_uiscale = atoi(argv[++j]);
|
||||||
|
} else if (!strcmp(argv[j],"--screensize") && more) {
|
||||||
|
Modes.screen_width = atoi(argv[++j]);
|
||||||
|
Modes.screen_height = atoi(argv[++j]);
|
||||||
} else if (!strcmp(argv[j],"--help")) {
|
} else if (!strcmp(argv[j],"--help")) {
|
||||||
showHelp();
|
showHelp();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -373,7 +385,6 @@ int main(int argc, char **argv) {
|
||||||
{
|
{
|
||||||
getInput();
|
getInput();
|
||||||
|
|
||||||
|
|
||||||
interactiveRemoveStaleAircrafts();
|
interactiveRemoveStaleAircrafts();
|
||||||
|
|
||||||
draw();
|
draw();
|
||||||
|
@ -387,7 +398,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
modesReadFromClient(c,"",decodeBinMessage);
|
modesReadFromClient(c,"",decodeBinMessage);
|
||||||
|
|
||||||
usleep(100000);
|
usleep(10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The user has stopped us, so close any socket we opened
|
// The user has stopped us, so close any socket we opened
|
||||||
|
|
Loading…
Reference in a new issue