viz1090/AircraftLabel.h

86 lines
1.5 KiB
C
Raw Normal View History

#include <string>
#include "SDL2/SDL_ttf.h"
#include <chrono>
#include "Label.h"
#include "Style.h"
class Aircraft;
class AircraftLabel {
public:
void update();
void clearAcceleration();
void calculateForces(Aircraft *check_p);
void applyForces();
2022-09-22 07:22:09 +02:00
void move(float dx, float dy);
2021-03-20 18:01:36 +01:00
void draw(SDL_Renderer *renderer, bool selected);
AircraftLabel(Aircraft *p, bool metric, int screen_width, int screen_height, TTF_Font *font);
private:
SDL_Rect getFullRect(int labelLevel);
float calculateDensity(Aircraft *check_p, int labelLevel);
Aircraft *p;
Label flightLabel;
Label altitudeLabel;
Label speedLabel;
Label debugLabel;
float labelLevel;
bool metric;
float x;
float y;
float w;
float h;
float target_w;
float target_h;
float dx;
float dy;
2022-09-22 07:22:09 +02:00
float x_buffer[15];
float y_buffer[15];
int buffer_idx;
int buffer_length = 15;
float ddx;
float ddy;
float opacity;
float target_opacity;
float pressure;
int screen_width;
int screen_height;
std::chrono::high_resolution_clock::time_point lastLevelChange;
///////////
2022-09-22 07:22:09 +02:00
float label_force = 0.01f;
float label_dist = 2.0f;
2022-09-22 07:22:09 +02:00
float density_force = 0.01f;
float attachment_force = 0.01f;
float attachment_dist = 10.0f;
2022-09-22 07:22:09 +02:00
float icon_force = 0.01f;
float icon_dist = 15.0f;
float boundary_force = 0.01f;
2022-09-22 07:22:09 +02:00
float damping_force = 0.65f;
float velocity_limit = 1.0f;
float edge_margin = 15.0f;
2022-09-22 07:22:09 +02:00
float drag_force = 0.00f;
Style style;
};