
Former-commit-id: 0fead3636422b4fcc2bc0dee8a30a137de50d69b Former-commit-id: b6345e37645d23a82edbb99859c51c1ff207a5c9
121 lines
2.5 KiB
C
121 lines
2.5 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 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
|
|
};
|
|
|
|
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();
|
|
|
|
//status.c
|
|
void updateStatus();
|
|
void drawStatus();
|
|
|
|
//planeObj.c
|
|
void updatePlanes();
|
|
|
|
|
|
#endif |