viz1090/structs.h
nathan 4933361fb4 started adding tap (debug only for now)
Former-commit-id: 0d01589322 [formerly 3f0f4f4235ba99d564d88f2bed86757b79b6afac] [formerly aef9365c434e1ba1d9146f7cf8c37706b80a96b2]
Former-commit-id: 98f78c5ae16d9c9014f1db2ab429348cecff59b4
Former-commit-id: e348bbf60e9a76dd0ff9b522da9ff2829cd9ef2a
2020-02-16 21:54:46 -08:00

133 lines
2.8 KiB
C

#ifndef STRUCTS
#define STRUCTS
#include "defs.h"
typedef struct AppData
{
SDL_Window *window;
SDL_Renderer *renderer;
SDL_Texture *texture;
TTF_Font *mapFont;
TTF_Font *mapBoldFont;
TTF_Font *listFont;
TTF_Font *messageFont;
TTF_Font *labelFont;
int mapFontWidth;
int mapFontHeight;
int labelFontWidth;
int labelFontHeight;
int messageFontWidth;
int messageFontHeight;
// map options
int showList;
int mapLogDist;
float maxDist;
//display options
int screen_upscale;
int screen_uiscale;
int screen_width;
int screen_height;
int screen_depth;
int fullscreen;
double centerLon;
double centerLat;
uint64_t touchDownTime;
int touchx;
int touchy;
uint64_t lastFrameTime;
} AppData;
AppData appData;
// mirrors aircraft struct in dump1090, separating for refactoring
struct planeObj {
uint32_t addr; // ICAO address
char flight[16]; // Flight number
unsigned char signalLevel[8]; // Last 8 Signal Amplitudes
double messageRate;
int altitude; // Altitude
int speed; // Velocity
int track; // Angle of flight
int vert_rate; // Vertical rate.
time_t seen; // Time at which the last packet was received
time_t seenLatLon; // Time at which the last packet was received
time_t prev_seen;
double lat, lon; // Coordinated obtained from CPR encoded data
//history
double oldLon[TRAIL_LENGTH];
double oldLat[TRAIL_LENGTH];
double oldHeading[TRAIL_LENGTH];
time_t oldSeen[TRAIL_LENGTH];
uint8_t oldIdx;
uint64_t created;
uint64_t msSeen;
uint64_t msSeenLatLon;
int live;
struct planeObj *next; // Next aircraft in our linked list
//// label stuff
int x, y, cx, cy, w, h;
float ox, oy, dox, doy, ddox, ddoy;
float pressure;
};
struct planeObj *planes;
struct {
double msgRate;
double avgSig;
int numPlanes;
int numVisiblePlanes;
double maxDist;
struct aircraft *closeCall;
} Status;
// functions
//font.c
TTF_Font *loadFont(char *, int);
void closeFont(TTF_Font *);
void drawString(char *, int, int, TTF_Font *, SDL_Color);
void drawString90(char *, int, int, TTF_Font *, SDL_Color);
void drawStringBG(char *, int, int, TTF_Font *, SDL_Color, SDL_Color);
//init.c
void init(char *);
void cleanup(void);
//input.c
void getInput(void);
//mapdata.c
void initMaps();
//list.c
void drawList(int top);
//draw.c
void draw();
void latLonFromScreenCoords(double *lat, double *lon, int x, int y);
//status.c
void updateStatus();
void drawStatus();
//planeObj.c
void updatePlanes();
#endif