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

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __SDL_OSD_DISPLAY_WIDGET_HEADER__
  2. #define __SDL_OSD_DISPLAY_WIDGET_HEADER__
  3. #include "videoWidget.h"
  4. #define OSD_FIELD_RECT_COUNTS 100
  5. #define ONE_METER_IN_BOTOM_PIXELS 150.f
  6. #define POINT_WIDTH_IN_METERS (10.f/ONE_METER_IN_BOTOM_PIXELS)
  7. #define CAMERA_HFOV_DEG 90.f
  8. #define CAMERA_HFOV_RAD (CAMERA_HFOV_DEG/57.2958f)
  9. #define CAMERA_VFOV_DEG 90.f
  10. #define CAMERA_VFOV_RAD (CAMERA_VFOV_DEG/57.2958f)
  11. class sdlOsdVideoWidget: public videoWidget {
  12. private:
  13. TEXTURE_HEAP_ITEM * m_pVisorTex;
  14. SDL_mutex * m_pParamProtector;
  15. SDL_Rect * m_pRects;
  16. float m_fRollAngle;
  17. float m_fYawAngle;
  18. float m_fPitchAngle;
  19. float m_fAlt;
  20. float m_fAirSpeed;
  21. float m_fGroundSpeed;
  22. float m_fClimbRate; /*< [m/s] Current climb rate.*/
  23. uint8_t m_bThrottle; /*%%*/
  24. int m_nHeadingDeg; /*< [deg] Current heading in compass units (0-360, 0=north).*/
  25. float m_fBatVoltage;
  26. float m_fTemperature;
  27. int16_t m_dJoyAxisRoll;
  28. int16_t m_dJoyAxisPitch;
  29. int16_t m_dJoyAxisYaw;
  30. int16_t m_dJoyAxisThrottle;
  31. void init_field();
  32. void printInteger(SDL_Renderer* pRenderer, int x, int y, int number, int papa = -1);
  33. void printFloat(SDL_Renderer* pRenderer, int x, int y, float number, int dec = 2, int papa = 3 );
  34. void drawVizorParams(SDL_Renderer* pRenderer);
  35. protected:
  36. virtual void drawAfter(SDL_Renderer* pRenderer);
  37. virtual bool create(void);
  38. public:
  39. explicit sdlOsdVideoWidget(CSTR path, int x, int y, int width, int height, bool decor = true, sdlCoreWidget* pParent = NULL);
  40. virtual ~sdlOsdVideoWidget();
  41. void setRoll(float Angle);
  42. void setPitch(float Angle);
  43. void setYaw(float Angle);
  44. void setAlt(float Angle);
  45. void setJoystickRoll(uint16_t value);
  46. void setJoystickPitch(uint16_t value);
  47. void setJoystickYaw(uint16_t value);
  48. void setJoistickThrottle(uint16_t value);
  49. void setTemperature(float t);
  50. void setVoltage(float v);
  51. void setGroundSpeed(float s);
  52. void setAirSpeed(float s);
  53. void setClimbRate(float cr);
  54. void setMagHeading(int mh);
  55. void setThrottle(int tp);
  56. };
  57. #endif