removed defs.h and structs.h
Former-commit-id: 63229bbc5bf3fb105b945f7b3e3025e624324193 Former-commit-id: f37adedb0101d03a37bfe83f09165dc83adf12cd
This commit is contained in:
parent
0a014bdd99
commit
9b5cab173e
|
@ -1,5 +1,4 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "defs.h"
|
|
||||||
#include "dump1090.h"
|
#include "dump1090.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
|
@ -97,6 +97,7 @@ void AppData::updateStatus() {
|
||||||
// struct aircraft *a = Modes.aircrafts;
|
// struct aircraft *a = Modes.aircrafts;
|
||||||
|
|
||||||
numVisiblePlanes = 0;
|
numVisiblePlanes = 0;
|
||||||
|
numPlanes = 0;
|
||||||
maxDist = 0;
|
maxDist = 0;
|
||||||
totalCount = 0;
|
totalCount = 0;
|
||||||
sigAccumulate = 0.0;
|
sigAccumulate = 0.0;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include "dump1090.h"
|
#include "dump1090.h"
|
||||||
#include "view1090.h"
|
#include "view1090.h"
|
||||||
#include "structs.h"
|
|
||||||
|
|
||||||
#include "AircraftList.h"
|
#include "AircraftList.h"
|
||||||
|
|
||||||
|
@ -33,9 +32,12 @@ class AppData {
|
||||||
char server[32];
|
char server[32];
|
||||||
|
|
||||||
int numVisiblePlanes;
|
int numVisiblePlanes;
|
||||||
|
int numPlanes;
|
||||||
double maxDist;
|
double maxDist;
|
||||||
int totalCount;
|
int totalCount;
|
||||||
|
double avgSig;
|
||||||
double sigAccumulate;
|
double sigAccumulate;
|
||||||
|
double msgRate;
|
||||||
double msgRateAccumulate;
|
double msgRateAccumulate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
14
Input.cpp
14
Input.cpp
|
@ -55,10 +55,14 @@ void Input::getInput()
|
||||||
view->maxDist /=1.0 + 4.0*event.mgesture.dDist;
|
view->maxDist /=1.0 + 4.0*event.mgesture.dDist;
|
||||||
view->mapTargetMaxDist = 0;
|
view->mapTargetMaxDist = 0;
|
||||||
view->mapMoved = 1;
|
view->mapMoved = 1;
|
||||||
|
|
||||||
|
if(mstime() - touchDownTime > 100) {
|
||||||
|
touchDownTime = 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_FINGERMOTION:;
|
case SDL_FINGERMOTION:;
|
||||||
isDragging = 1;
|
touchDownTime = 0;
|
||||||
view->moveCenterRelative( view->screen_width * event.tfinger.dx, view->screen_height * event.tfinger.dy);
|
view->moveCenterRelative( view->screen_width * event.tfinger.dx, view->screen_height * event.tfinger.dy);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -70,9 +74,7 @@ void Input::getInput()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_FINGERUP:
|
case SDL_FINGERUP:
|
||||||
if(isDragging) {
|
if(mstime() - touchDownTime < 120) {
|
||||||
isDragging = 0;
|
|
||||||
} else if(mstime() - touchDownTime < 120) {
|
|
||||||
touchx = view->screen_width * event.tfinger.x;
|
touchx = view->screen_width * event.tfinger.x;
|
||||||
touchy = view->screen_height * event.tfinger.y;
|
touchy = view->screen_height * event.tfinger.y;
|
||||||
tapCount++;
|
tapCount++;
|
||||||
|
@ -99,7 +101,6 @@ void Input::getInput()
|
||||||
touchx = event.motion.x;
|
touchx = event.motion.x;
|
||||||
touchy = event.motion.y;
|
touchy = event.motion.y;
|
||||||
tapCount = event.button.clicks;
|
tapCount = event.button.clicks;
|
||||||
isDragging = 0;
|
|
||||||
|
|
||||||
view->registerClick(tapCount, touchx, touchy);
|
view->registerClick(tapCount, touchx, touchy);
|
||||||
}
|
}
|
||||||
|
@ -111,7 +112,6 @@ void Input::getInput()
|
||||||
view->registerMouseMove(event.motion.x, event.motion.y);
|
view->registerMouseMove(event.motion.x, event.motion.y);
|
||||||
|
|
||||||
if (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT)) {
|
if (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT)) {
|
||||||
isDragging = 1;
|
|
||||||
view->moveCenterRelative(event.motion.xrel, event.motion.yrel);
|
view->moveCenterRelative(event.motion.xrel, event.motion.yrel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,8 +123,6 @@ void Input::getInput()
|
||||||
Input::Input(AppData *appData, View *view) {
|
Input::Input(AppData *appData, View *view) {
|
||||||
this->view = view;
|
this->view = view;
|
||||||
this->appData = appData;
|
this->appData = appData;
|
||||||
|
|
||||||
isDragging = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
1
Input.h
1
Input.h
|
@ -18,7 +18,6 @@ public:
|
||||||
int touchx;
|
int touchx;
|
||||||
int touchy;
|
int touchy;
|
||||||
int tapCount;
|
int tapCount;
|
||||||
int isDragging;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
8
View.cpp
8
View.cpp
|
@ -1,5 +1,5 @@
|
||||||
#include "dump1090.h"
|
#include "dump1090.h"
|
||||||
#include "structs.h"
|
|
||||||
#include "SDL2/SDL2_rotozoom.h"
|
#include "SDL2/SDL2_rotozoom.h"
|
||||||
#include "SDL2/SDL2_gfxPrimitives.h"
|
#include "SDL2/SDL2_gfxPrimitives.h"
|
||||||
//color schemes
|
//color schemes
|
||||||
|
@ -400,15 +400,15 @@ void View::drawStatus() {
|
||||||
drawStatusBox(&left, &top, "loc", strLoc, style.buttonColor);
|
drawStatusBox(&left, &top, "loc", strLoc, style.buttonColor);
|
||||||
|
|
||||||
char strPlaneCount[10] = " ";
|
char strPlaneCount[10] = " ";
|
||||||
snprintf(strPlaneCount, 10,"%d/%d", Status.numVisiblePlanes, Status.numPlanes);
|
snprintf(strPlaneCount, 10,"%d/%d", appData->numVisiblePlanes, appData->numPlanes);
|
||||||
drawStatusBox(&left, &top, "disp", strPlaneCount, style.buttonColor);
|
drawStatusBox(&left, &top, "disp", strPlaneCount, style.buttonColor);
|
||||||
|
|
||||||
char strMsgRate[18] = " ";
|
char strMsgRate[18] = " ";
|
||||||
snprintf(strMsgRate, 18,"%.0f/s", Status.msgRate);
|
snprintf(strMsgRate, 18,"%.0f/s", appData->msgRate);
|
||||||
drawStatusBox(&left, &top, "rate", strMsgRate, style.buttonColor);
|
drawStatusBox(&left, &top, "rate", strMsgRate, style.buttonColor);
|
||||||
|
|
||||||
char strSig[18] = " ";
|
char strSig[18] = " ";
|
||||||
snprintf(strSig, 18, "%.0f%%", 100.0 * Status.avgSig / 1024.0);
|
snprintf(strSig, 18, "%.0f%%", 100.0 * appData->avgSig / 1024.0);
|
||||||
drawStatusBox(&left, &top, "sAvg", strSig, style.buttonColor);
|
drawStatusBox(&left, &top, "sAvg", strSig, style.buttonColor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
42
View.h
42
View.h
|
@ -1,11 +1,48 @@
|
||||||
#ifndef VIEW_H
|
#ifndef VIEW_H
|
||||||
#define VIEW_H
|
#define VIEW_H
|
||||||
|
|
||||||
#include "AppData.h"
|
#include "AppData.h"
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
#include "SDL2/SDL.h"
|
#include "SDL2/SDL.h"
|
||||||
#include "SDL2/SDL_ttf.h"
|
#include "SDL2/SDL_ttf.h"
|
||||||
|
|
||||||
|
//defs - should all move to config file setup
|
||||||
|
#define ROUND_RADIUS 3 //radius of text box corners
|
||||||
|
|
||||||
|
#define CENTEROFFSET .375 //vertical offset for middle of screen
|
||||||
|
|
||||||
|
#define TRAIL_LENGTH 120
|
||||||
|
#define TRAIL_TTL 240.0
|
||||||
|
#define DISPLAY_ACTIVE 30
|
||||||
|
#define TRAIL_TTL_STEP 2
|
||||||
|
|
||||||
|
#define MIN_MAP_FEATURE 2
|
||||||
|
|
||||||
|
#define FRAMETIME 33
|
||||||
|
|
||||||
|
#define PAD 5
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// This should go to a full theming class
|
||||||
|
//
|
||||||
|
typedef struct Style {
|
||||||
|
SDL_Color backgroundColor;
|
||||||
|
|
||||||
|
SDL_Color selectedColor;
|
||||||
|
SDL_Color planeColor;
|
||||||
|
SDL_Color planeGoneColor;
|
||||||
|
|
||||||
|
SDL_Color mapInnerColor;
|
||||||
|
SDL_Color mapOuterColor;
|
||||||
|
SDL_Color scaleBarColor;
|
||||||
|
|
||||||
|
SDL_Color buttonColor;
|
||||||
|
} Style;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class View {
|
class View {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -28,6 +65,9 @@ class View {
|
||||||
void drawStatus();
|
void drawStatus();
|
||||||
|
|
||||||
Aircraft *selectedAircraft;
|
Aircraft *selectedAircraft;
|
||||||
|
|
||||||
|
Style style;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int screenDist(float d);
|
int screenDist(float d);
|
||||||
void pxFromLonLat(float *dx, float *dy, float lon, float lat);
|
void pxFromLonLat(float *dx, float *dy, float lon, float lat);
|
||||||
|
|
21
defs.h
21
defs.h
|
@ -1,21 +0,0 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include "SDL2/SDL.h"
|
|
||||||
#include "SDL2/SDL_ttf.h"
|
|
||||||
|
|
||||||
#define ROUND_RADIUS 3 //radius of text box corners
|
|
||||||
|
|
||||||
#define CENTEROFFSET .375 //vertical offset for middle of screen
|
|
||||||
|
|
||||||
#define TRAIL_LENGTH 120
|
|
||||||
#define TRAIL_TTL 240.0
|
|
||||||
#define DISPLAY_ACTIVE 30
|
|
||||||
#define TRAIL_TTL_STEP 2
|
|
||||||
|
|
||||||
#define MIN_MAP_FEATURE 2
|
|
||||||
|
|
||||||
#define FRAMETIME 33
|
|
||||||
|
|
||||||
#define PAD 5
|
|
|
@ -1 +1 @@
|
||||||
eddfb25457316beaa3ba58e14e88f2e187c4acaf
|
c64f58d5a0b612b1c29e1585a52d19dfa7ac4b92
|
|
@ -29,11 +29,9 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "view1090.h"
|
#include "view1090.h"
|
||||||
#include "structs.h"
|
|
||||||
#include "AppData.h"
|
#include "AppData.h"
|
||||||
#include "View.h"
|
#include "View.h"
|
||||||
#include "Input.h"
|
#include "Input.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
//time utility, might change to std::chrono
|
//time utility, might change to std::chrono
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "structs.h"
|
#include "SDL2/SDL.h"
|
||||||
|
|
||||||
extern SDL_Color pink;
|
extern SDL_Color pink;
|
||||||
extern SDL_Color purple;
|
extern SDL_Color purple;
|
||||||
|
|
48
structs.h
48
structs.h
|
@ -1,48 +0,0 @@
|
||||||
#ifndef STRUCTS
|
|
||||||
#define STRUCTS
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
|
|
||||||
// #include "AircraftData.h"
|
|
||||||
|
|
||||||
|
|
||||||
struct {
|
|
||||||
double msgRate;
|
|
||||||
double avgSig;
|
|
||||||
int numPlanes;
|
|
||||||
int numVisiblePlanes;
|
|
||||||
double maxDist;
|
|
||||||
struct aircraft *closeCall;
|
|
||||||
} Status;
|
|
||||||
typedef struct Style {
|
|
||||||
SDL_Color backgroundColor;
|
|
||||||
|
|
||||||
SDL_Color selectedColor;
|
|
||||||
SDL_Color planeColor;
|
|
||||||
SDL_Color planeGoneColor;
|
|
||||||
|
|
||||||
SDL_Color mapInnerColor;
|
|
||||||
SDL_Color mapOuterColor;
|
|
||||||
SDL_Color scaleBarColor;
|
|
||||||
|
|
||||||
SDL_Color buttonColor;
|
|
||||||
} Style;
|
|
||||||
|
|
||||||
// globals
|
|
||||||
//extern AppData appData;
|
|
||||||
extern Style style;
|
|
||||||
|
|
||||||
// functions
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//status.c
|
|
||||||
void updateStatus();
|
|
||||||
void drawStatus();
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in a new issue