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 "defs.h"
|
||||
#include "dump1090.h"
|
||||
#include <ctime>
|
||||
#include <list>
|
||||
|
|
|
@ -97,6 +97,7 @@ void AppData::updateStatus() {
|
|||
// struct aircraft *a = Modes.aircrafts;
|
||||
|
||||
numVisiblePlanes = 0;
|
||||
numPlanes = 0;
|
||||
maxDist = 0;
|
||||
totalCount = 0;
|
||||
sigAccumulate = 0.0;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include "dump1090.h"
|
||||
#include "view1090.h"
|
||||
#include "structs.h"
|
||||
|
||||
#include "AircraftList.h"
|
||||
|
||||
|
@ -33,9 +32,12 @@ class AppData {
|
|||
char server[32];
|
||||
|
||||
int numVisiblePlanes;
|
||||
int numPlanes;
|
||||
double maxDist;
|
||||
int totalCount;
|
||||
double avgSig;
|
||||
double sigAccumulate;
|
||||
double msgRate;
|
||||
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->mapTargetMaxDist = 0;
|
||||
view->mapMoved = 1;
|
||||
|
||||
if(mstime() - touchDownTime > 100) {
|
||||
touchDownTime = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_FINGERMOTION:;
|
||||
isDragging = 1;
|
||||
touchDownTime = 0;
|
||||
view->moveCenterRelative( view->screen_width * event.tfinger.dx, view->screen_height * event.tfinger.dy);
|
||||
break;
|
||||
|
||||
|
@ -70,9 +74,7 @@ void Input::getInput()
|
|||
break;
|
||||
|
||||
case SDL_FINGERUP:
|
||||
if(isDragging) {
|
||||
isDragging = 0;
|
||||
} else if(mstime() - touchDownTime < 120) {
|
||||
if(mstime() - touchDownTime < 120) {
|
||||
touchx = view->screen_width * event.tfinger.x;
|
||||
touchy = view->screen_height * event.tfinger.y;
|
||||
tapCount++;
|
||||
|
@ -99,7 +101,6 @@ void Input::getInput()
|
|||
touchx = event.motion.x;
|
||||
touchy = event.motion.y;
|
||||
tapCount = event.button.clicks;
|
||||
isDragging = 0;
|
||||
|
||||
view->registerClick(tapCount, touchx, touchy);
|
||||
}
|
||||
|
@ -111,7 +112,6 @@ void Input::getInput()
|
|||
view->registerMouseMove(event.motion.x, event.motion.y);
|
||||
|
||||
if (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT)) {
|
||||
isDragging = 1;
|
||||
view->moveCenterRelative(event.motion.xrel, event.motion.yrel);
|
||||
}
|
||||
}
|
||||
|
@ -123,8 +123,6 @@ void Input::getInput()
|
|||
Input::Input(AppData *appData, View *view) {
|
||||
this->view = view;
|
||||
this->appData = appData;
|
||||
|
||||
isDragging = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
1
Input.h
1
Input.h
|
@ -18,7 +18,6 @@ public:
|
|||
int touchx;
|
||||
int touchy;
|
||||
int tapCount;
|
||||
int isDragging;
|
||||
};
|
||||
|
||||
#endif
|
8
View.cpp
8
View.cpp
|
@ -1,5 +1,5 @@
|
|||
#include "dump1090.h"
|
||||
#include "structs.h"
|
||||
|
||||
#include "SDL2/SDL2_rotozoom.h"
|
||||
#include "SDL2/SDL2_gfxPrimitives.h"
|
||||
//color schemes
|
||||
|
@ -400,15 +400,15 @@ void View::drawStatus() {
|
|||
drawStatusBox(&left, &top, "loc", strLoc, style.buttonColor);
|
||||
|
||||
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);
|
||||
|
||||
char strMsgRate[18] = " ";
|
||||
snprintf(strMsgRate, 18,"%.0f/s", Status.msgRate);
|
||||
snprintf(strMsgRate, 18,"%.0f/s", appData->msgRate);
|
||||
drawStatusBox(&left, &top, "rate", strMsgRate, style.buttonColor);
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
|
40
View.h
40
View.h
|
@ -6,6 +6,43 @@
|
|||
#include "SDL2/SDL.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 {
|
||||
|
||||
private:
|
||||
|
@ -28,6 +65,9 @@ class View {
|
|||
void drawStatus();
|
||||
|
||||
Aircraft *selectedAircraft;
|
||||
|
||||
Style style;
|
||||
|
||||
public:
|
||||
int screenDist(float d);
|
||||
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 "structs.h"
|
||||
#include "AppData.h"
|
||||
#include "View.h"
|
||||
#include "Input.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
//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 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