You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

61 lines
2.1 KiB

#ifndef __SDL_OSD_DISPLAY_WIDGET_HEADER__
#define __SDL_OSD_DISPLAY_WIDGET_HEADER__
#include "videoWidget.h"
#define OSD_FIELD_RECT_COUNTS 100
#define ONE_METER_IN_BOTOM_PIXELS 150.f
#define POINT_WIDTH_IN_METERS (10.f/ONE_METER_IN_BOTOM_PIXELS)
#define CAMERA_HFOV_DEG 90.f
#define CAMERA_HFOV_RAD (CAMERA_HFOV_DEG/57.2958f)
#define CAMERA_VFOV_DEG 90.f
#define CAMERA_VFOV_RAD (CAMERA_VFOV_DEG/57.2958f)
class sdlOsdVideoWidget: public videoWidget {
private:
TEXTURE_HEAP_ITEM * m_pVisorTex;
SDL_mutex * m_pParamProtector;
SDL_Rect * m_pRects;
float m_fRollAngle;
float m_fYawAngle;
float m_fPitchAngle;
float m_fAlt;
float m_fAirSpeed;
float m_fGroundSpeed;
float m_fClimbRate; /*< [m/s] Current climb rate.*/
uint8_t m_bThrottle; /*%%*/
int m_nHeadingDeg; /*< [deg] Current heading in compass units (0-360, 0=north).*/
float m_fBatVoltage;
float m_fTemperature;
int16_t m_dJoyAxisRoll;
int16_t m_dJoyAxisPitch;
int16_t m_dJoyAxisYaw;
int16_t m_dJoyAxisThrottle;
void init_field();
void printInteger(SDL_Renderer* pRenderer, int x, int y, int number, int papa = -1);
void printFloat(SDL_Renderer* pRenderer, int x, int y, float number, int dec = 2, int papa = 3 );
void drawVizorParams(SDL_Renderer* pRenderer);
protected:
virtual void drawAfter(SDL_Renderer* pRenderer);
virtual bool create(void);
public:
explicit sdlOsdVideoWidget(CSTR path, int x, int y, int width, int height, bool decor = true, sdlCoreWidget* pParent = NULL);
virtual ~sdlOsdVideoWidget();
void setRoll(float Angle);
void setPitch(float Angle);
void setYaw(float Angle);
void setAlt(float Angle);
void setJoystickRoll(uint16_t value);
void setJoystickPitch(uint16_t value);
void setJoystickYaw(uint16_t value);
void setJoistickThrottle(uint16_t value);
void setTemperature(float t);
void setVoltage(float v);
void setGroundSpeed(float s);
void setAirSpeed(float s);
void setClimbRate(float cr);
void setMagHeading(int mh);
void setThrottle(int tp);
};
#endif