added flag for fps display

This commit is contained in:
nathan 2020-12-07 21:19:53 -08:00
parent e9372475c9
commit 56a4f252d6
4 changed files with 34 additions and 14 deletions

12
.gitignore vendored
View file

@ -12,4 +12,16 @@ thumbs.db
*.shx *.shx
*.geojson *.geojson
*.cpg
*.dbf
*.zip*
*.prj
*.xml
*.html
*.txt
airportnames
mapnames
viz1090 viz1090

View file

@ -1548,9 +1548,11 @@ void View::draw() {
//drawMouse(); //drawMouse();
drawClick(); drawClick();
if(fps) {
char fps[60] = " "; char fps[60] = " ";
snprintf(fps,40," %d lines @ %.1ffps", lineCount, 1000.0 / elapsed(lastFrameTime)); snprintf(fps,40," %d lines @ %.1ffps", lineCount, 1000.0 / elapsed(lastFrameTime));
drawStringBG(fps, 0,0, mapFont, style.subLabelColor, style.backgroundColor); drawStringBG(fps, 0,0, mapFont, style.subLabelColor, style.backgroundColor);
}
SDL_RenderPresent(renderer); SDL_RenderPresent(renderer);
@ -1569,6 +1571,7 @@ View::View(AppData *appData){
screen_width = 0; screen_width = 0;
screen_height = 0; screen_height = 0;
screen_depth = 32; screen_depth = 32;
fps = 0;
fullscreen = 0; fullscreen = 0;
screen_index = 0; screen_index = 0;

2
View.h
View file

@ -215,6 +215,8 @@ class View {
//////////////// ////////////////
bool metric; bool metric;
bool fps;
float maxDist; float maxDist;
float currentMaxDist; float currentMaxDist;

View file

@ -48,16 +48,17 @@ void showHelp(void) {
"-----------------------------------------------------------------------------\n" "-----------------------------------------------------------------------------\n"
"| viz1090 ADSB Viewer Ver : 0.1 |\n" "| viz1090 ADSB Viewer Ver : 0.1 |\n"
"-----------------------------------------------------------------------------\n" "-----------------------------------------------------------------------------\n"
"--server <IPv4/hosname> TCP Beast output listen IPv4 (default: 127.0.0.1)\n" "--fps Show current framerate\n"
"--port <port> TCP Beast output listen port (default: 30005)\n" "--fullscreen Start fullscreen\n"
"--lat <latitude> Latitude in degrees\n" "--help Show this help\n"
"--lon <longitude> Longitude in degrees\n" "--lat <latitude> Latitude in degrees\n"
"--metric Use metric units\n" "--lon <longitude> Longitude in degrees\n"
"--help Show this help\n" "--metric Use metric units\n"
"--uiscale <factor> UI global scaling (default: 1)\n" "--port <port> TCP Beast output listen port (default: 30005)\n"
"--screensize <width> <height> Set frame buffer resolution (default: screen resolution)\n" "--server <IPv4/hosname> TCP Beast output listen IPv4 (default: 127.0.0.1)\n"
"--screenindex <i> Set the index of the display to use (default: 0)\n" "--screensize <width> <height> Set frame buffer resolution (default: screen resolution)\n"
"--fullscreen Start fullscreen\n" "--screenindex <i> Set the index of the display to use (default: 0)\n"
"--uiscale <factor> UI global scaling (default: 1)\n"
); );
} }
@ -94,6 +95,8 @@ int main(int argc, char **argv) {
view.centerLon = appData.modes.fUserLon; view.centerLon = appData.modes.fUserLon;
} else if (!strcmp(argv[j],"--metric")) { } else if (!strcmp(argv[j],"--metric")) {
view.metric = 1; view.metric = 1;
} else if (!strcmp(argv[j],"--fps")) {
view.fps = 1;
} else if (!strcmp(argv[j],"--fullscreen")) { } else if (!strcmp(argv[j],"--fullscreen")) {
view.fullscreen = 1; view.fullscreen = 1;
} else if (!strcmp(argv[j],"--screenindex")) { } else if (!strcmp(argv[j],"--screenindex")) {